HTTP and Sockets Lecture 6

Slides:



Advertisements
Similar presentations
COEN 445 Communication Networks and Protocols Lab 4
Advertisements

Network Programming Chapter 11 Lecture 6. Networks.
Programming TCP Clients Version InetAddress Class An IP address identifies uniquely a host in the internet, which consists of 4 numbers (1 byte.
Prepared By E. Musa Alyaman1 URLs, InetAddresses, and URLConnections Chapter 9.
Hypertext Transfer Protocol Kyle Roth Mark Hoover.
Networking Support In Java 2 Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Internet Programming In Java. References Java.sun.com Java552 Many of the programs shown.
CIS – Spring Instructors: Geoffrey Fox, Bryan Carpenter Computational Science and.
Networking Support In Java Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
2: Application Layer1 Socket Programming. 2: Application Layer2 Socket-programming using TCP Socket: a door between application process and end- end-transport.
Socket Communication Sockets provide an abstraction of two-point communication The two sides only read/write without concern for how data is translated.
1 Web Content Delivery Reading: Section and COS 461: Computer Networks Spring 2007 (MW 1:30-2:50 in Friend 004) Ioannis Avramopoulos Instructor:
13-Jul-15 Sockets and URLs. 2 Sockets A socket is a low-level software device for connecting two computers together Sockets can also be used to connect.
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
 Proxy Servers are software that act as intermediaries between client and servers on the Internet.  They help users on private networks get information.
Agenda Internet Address Pair Internet Address Pair IP Address IP Address Port Address Port Address Network Address Translation (NAT) Network Address Translation.
Web Security Programming I Building Security in from the Start Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and.
2: Application Layer1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
Implementing ISA Server Publishing. Introduction What Are Web Publishing Rules? ISA Server uses Web publishing rules to make Web sites on protected networks.
ASHIMA KALRA IMPORTANT TERMS.  WWW WWW  URL URL  HTTP PROTOCOL HTTP PROTOCOL  PROXIES PROXIES.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 21.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Practicum: - Client-Server Computing in Java Fundamental Data Structures and Algorithms Margaret Reid-Miller 13 April 2004.
Fundamentals of Proxying. Proxy Server Fundamentals  Proxy simply means acting on someone other’s behalf  A Proxy acts on behalf of the client or user.
CS 11 java track: lecture 6 This week: networking basics Sockets Vectors parsing strings.
Sockets Sockets A socket is an object that encapsulates a TCP/IP connection There is a socket on both ends of a connection, the client side and the server.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 22.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
Lab 2 Primer Assignment 3 Structure File I/O More parsing and HTTP Formatting.
2007cs Servers on the Web. The World-Wide Web 2007 cs CSS JS HTML Server Browser JS CSS HTML Transfer of resources using HTTP.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit9: Internet programming 1.
Object-Orientated Analysis, Design and Programming
Tiny http client and server
Echo Networking COMP
Module 3: Enabling Access to Internet Resources
Threads in Java Two ways to start a thread
NET 536 Network Security Firewalls and VPN
Network Programming in Java CS 1111 Ryan Layer May 3, 2010
WWW and HTTP King Fahd University of Petroleum & Minerals
Networking COMP
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to Networking
Networking with Java 2.
Sockets and URLs 17-Sep-18.
6.6 Firewalls Packet Filter (=filtering router)
Sockets and URLs 13-Nov-18.
Recitation 12: ProxyLab Part 1
Clients and Servers 19-Nov-18.
HTTP Hypertext Transfer Protocol
Basic Protocols 24-Nov-18.
URL in Java C343 Lab (Week 13).
Socket programming - Java
IS 4506 Server Configuration (HTTP Server)
Clients and Servers 1-Dec-18.
Networking.
Sockets and URLs 3-Dec-18.
Firewalls Jiang Long Spring 2002.
Basic Protocols 19-Feb-19.
World Wide Web Uniform Resource Locator hostname [:port]/path
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
HTTP Hypertext Transfer Protocol
Uniform Resource Locator: URL
Clients and Servers 19-Jul-19.
CS18000: Problem Solving and Object-Oriented Programming
Clients and Servers 13-Sep-19.
Presentation transcript:

HTTP and Sockets Lecture 6 cs193i – Internet Technologies Summer 2004 Stanford University

Administrative Stuff Lab #2 due today HW #2 due July 21 Midterm Monday, July 19, in class

Midterm In class, Monday, July 19 Previous quarter’s exam online Closed-book 1 8x11 cheat sheet Short-answer

Today’s Discussion HTTP Wrap-up Sockets in Java HTTP 1.1 additions HTTP Proxies Sockets in Java

Persistent Connections HTTP 1.0 -- Connections close by Default No need for Content-length, end signaled by EOF (in-band signal) HTTP 1.1 -- Persistent by Default Must use Content-length

Chunked-Transfer Encoding Problem: Content-length costly for server May not know if generated dynamically Solution Server omits Content-Length Transfer-encoding: chunked Send Data in Chunks, Prefixed by length in Hex End is marked with Chunk Length 0

HTTP 1.1 Virtual Hosts Problem: Solution: Want multiple web sites hosted on single server Incoming requests must be directed to return appropriate web site’s page Solution: Request includes host name header http://www.foo.com host:www.foo.com

Try This At Home telnet cva.stanford.edu 80 GET / HTTP/1.1 Host:cva.stanford.edu Connection:Keep-Alive GET /group_mtg.html HTTP/1.1 Connection:Close

HTTP Proxy Servers "Middlemen" between clients and servers May "rewrite" HTTP requests and responses Proxy Server Looks like a server sending responses Looks like a client making requests

Why Proxy Servers? Content filtering Packet filter Prevent children from accessing sites Used to contact server in special way Firewall or circuit relay Security Rewrite content Swedish chef Redirect requests Content router To improve performance Logging activity

Why Proxy Servers? Web cache is also a type of proxy! RT latency reduced

Why Proxy Servers? Content Router

Why Proxy Servers? Content Router

Why Content Routers? Content Router

Why Proxy Servers? Content Router

Why Proxy Servers? Anonymizer

Why Proxy Servers? Translation

Why Proxy Servers? Translation http://translate.google.com/translate?hl=en&sl=es&u=http://espanol.yahoo.com/&prev=/search%3Fq%3Dspanish%26hl%3Den%26lr%3D%26ie%3DUTF-8

Requests via Proxy Client must realize talking to proxy Request header: GET path HTTP/1.0 Client must use absolute path! GET / HTTP/1.0 GET http://www.yahoo.com/ HTTP/1.0

Five Minute Break

Sockets in Java (Client) java.net.socket Create Socket Socket c = new Socket(“hostname”, port); OR Socket c = new Socket(“IP addr”, port);

Reading/Writing to Sockets Just like performing file I/O in Java Create input/output streams to read/write to/from socket Output example: PrintWriter class new PrintWriter(c.getOutputStream(), true); Input example: BufferedReader class new BufferedReader(new InputSreamReader(c.getInputStream());

Sockets in Java (Server) Create ServerSocket Socket listen = new ServerSocket(port); Create Socket ServerSocket.accept() Blocks until connection established Socket s =new listenSocket.accept(); Create input/output streams Close when finished

Exceptions Sockets throw exceptions when something goes wrong UnknownHostExcpetion Handle using try/catch pairs try{ (statement;)* }catch(ExceptionType e){ }finally{ } Can have multiple catch clauses for handling different exceptions

URL Class Automatically decomposes string into parts: getHost() getPort() getProtocol() getFile() // path

What do you do with this stuff? StringTokenizer class Allows you to grab tokenized strings one at a time You can specify what delineates strings Example: < or > could be delineators Pattern and Matcher classes Create pattern Use Matcher class to compare strings to pattern