Beruflich Dokumente
Kultur Dokumente
CCN
Lecture 21
request-response Protocol
HTTP functions as a request-response protocol in the client-server computing model. In HTTP, a web browser, for example, acts as a client, while an application running on a computer hosting a web site functions as a server. The client submits an HTTP request message to the server. The server, which stores content, or provides resources, such as HTML files, or performs other functions on behalf of the client, returns a response message to the client. A response contains completion status information about the request and may contain any content requested by the client in its message body.
HTTP
HTTP: hypertext transfer protocol Webs application layer protocol Client/server model
PC running Explorer
client: browser that requests, receives, displays Web objects server: Web server sends objects in response to requests
Mac running Navigator
HTTP
Uses TCP:
client initiates bi-directional TCP connection (via socket) to server, port 80 server accepts TCP connection from client HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
HTTP is stateless
server maintains no information about past client requests
HTTP non-persistent
HTTP/1.0 One request/response per connection
Several extra round trips added to transfer Connection handling, extra packets
Single Non-Persistent
Client
0 RTT
Client opens TCP connection
Server
SYN
SYN
1 RTT
Client sends HTTP request for HTML
DAT ACK
2 RTT
FIN ACK SYN
SYN
3 RTT
Client sends HTTP request for image
ACK DAT
Server reads from disk
ACK
4 RTT
Image begins to arrive
DAT
On same TCP connection: server, accept request, responds, accept new request,.
Server
1 RTT
Client sends HTTP request for image
DAT
2 RTT
Image begins to arrive
Request Response
to indicate the command or action that the client wants performed; to specify a resource upon which the action should be taken; and to indicate to the server what version of HTTP the client is using.
Method
The method is simply the type of action that the client wants the server to take; it is always specified in upper case letters. There are eight standard methods defined in HTTP/1.1, of which three are widely used: GET, HEAD and POST.
request-url
GET /index.html HTTP/1.1 Host: www.ucp.edu.pk User-agent: Mozilla/4.0 header Accept:text/html,text/plain lines Connection: keep-alive Accept-language:english (extra line feed)
Return object Send data to server (forms) Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving written in response headers, without having to transport the entire content.
POST
HEAD
header lines
The status code 200 indicates that this is a successful response to a request
200 OK
request succeeded, requested object later in this message requested object moved, new location specified later in this message (Location:) request message not understood by server requested document not found on this server
128.143.71.21 is not on my local network. 128.143.71.21 is on packet to my Therefore, I need to send the my local network. defaultTherefore, I can send the packet directly. gateway with address 192.168.1.1
DNS: The IP address of ARP: What is the MAC ucp.edu.pk is ARP: The MAC address of address of 192.168.1.1? 128.143.71.21 192.168.1.1 is 00:e0:f9:23:a8:20 ARP: What is the MAC ARP: The of 128.143.71.21? address MAC address of 128.143.71.21 is 00:20:af:03:98:28
frame
frame
OUR PC: http page Source IP Address: 192.168.1.5 Source MAC Address: 00:f7:09:56:a5:bf
Our Router: Destination IP Address: (ucp.edu.pk) 128.143.71.21 Destination MAC Address: 00:e0:f9:23:a8:20
ENCAPSULATION
http page Source IP Address: 192.168.1.5 (PC) Source MAC Address: 00:f7:09:56:a5:bf (PC)
Source MAC ADDRESS: 00:f7:09:56:a5:bf (OUR PC) Source IP ADDRESS: 192.168.1.5 (OUR PC) Destina IP ADDRESS: 128.143.71.21 (UCP.EDU.PK)
192.168.1.5
1 2
S: 138.76.29.7, 5001 D: 128.143.71.21, 80
192.168.1.1
S: 128.143.71.21, 80 D: 192.168.1.5, 58631
138.76.29.7
S: 128.143.71.21, 80 D: 138.76.29.7, 5001
Application data
Application Data in this frame GET /index.html HTTP/1.1 Host: www.ucp.edu.pk User-agent: Mozilla/4.0 Accept:text/html,text/plain Connection: keep-alive Accept-language:english
Ethernet Header
IP Header
Application data
Ethernet Trailer
TCP Header
Ethernet Header
IP Header
Application data
Ethernet Trailer
IP Header
32 bits
version (4 bits) header length DS ECN flags (3 bits) Total Length (in bytes) (16 bits) Fragment Offset (13 bits) Header Checksum (16 bits)
Ethernet Header
IP Header
TCP Header
Application data
Ethernet Trailer
Ethernet frame
Frame
CRC
Ethernet Header
IP Header
TCP Header
Application data
Ethernet Trailer
Ethernet frame