HyperText Transfer Protocol
UDP/TCP
- IP does not provide reliability / specify application
- UDP ... User Datagram Protocol
- TCP ... Transmission Control Protocol
UDP ... minimum mechanism
- Port specifies application on the host
- Checks only length and checksum
- Short transaction
- Streaming of multimedia (audio/video)
- Limited usage in LAN
- Broadcast/Multicast
Major Applications
- DHCP (67,68) ... Dynamic Host Configuration Protocol
- TFTP (69) ... Trivial File Transfer Protocol
- NFS (2049) ... Network File System
- NTP (123) ... Network Time Protocol
- DNS (53) ... Domain Name System (Server)
TCP
- RFC 793
- Connection-Oriented
- End-to-end Reliability
- 16 bit port number
- Specifies application (same as UDP)
Sequence Number
- the sequence number of the first data of this segment
- if SYN
- syncronize to this number
- Next number is (this number) + 1
- if ACK
- I expect your next sequence number to be this value + 1
Control bits (Flags)
- URG: Urgent Pointer field significant
- ACK: Acknowledgment field significant
- PSH: Push Function
- RST: Reset the connection
- SYN: Synchronize sequence numbers
- FIN: No more data from sender
Major Applications
- telnet (23) ... old, lame
- ftp (21) ... old, lame, hard to handle in firewall
- ssh (22) ... remote terminal, file transfer
- SMTP (25) ... Simple Mail Transfer Protocol
- POP (110) ... Post Office Protocol
- HTTP (80) ... HyperText Transfer Protocol
- whois (43) ... whois (nicname)
HTTP
- HyperText Transfer Protocol
- HyperText Markup Language = HTML
- Uniform Resource Locator = URL
HTTP version 1.0
- Connection to HTTP server
GET / HTTP/1.0
HTTP/1.0 200 OK Content-Type: text/html ... (header) <html> ... (content) </html>
RFC for HTTP/1.1
Request/Response
- one response for one request
- request/response chain (1.4)
request chain ------------------------> UA -----v----- A -----v----- B -----v----- O <----------------------- response chain
Protocol Parameters
- HTTP Version
- Uniform Resorce Identifier (URI/URL)
- Date/Time
- Character Sets
- Content Coding / Transfer Encoding
- Media Types
- Quality / Language
HTTP Version
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
URI
- also URL
- http URL
http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
Character sets
- charsets for japanese
- iso-2022-jp
- shift_jis
- euc-jp
- utf-8
- Other
- iso-8859-1 (Latin), euc-kr, gb2312, koi8-r
Media Types
- type/subtype
- text ... plain, html, css, xml
- image ... jpeg, gif, png
- audio ... mpeg, midi, x-wav
- model ... vrml
Languages
- ja ... Japanese
- en ... English
- en_US ... English in the United States
HTTP Message
- Request / Response
- Message Headers
- Message Body
Message Headers
message-header = field-name ":" [ field-value ]
- General-Header, Request-Header, Response-Header, Entity-Header
Request
Request-Line = Method SP Request-URI SP HTTP-Version CRLF
Method
- OPTIONS
- GET, HEAD, POST
- PUT, DELETE
- TRACE, CONNECT
Request-URI
Request-URI = "*" | absoluteURI | abs_path | authority
Response
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
Status Code
- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received, understood, and accepted
- 3xx: Redirection - Further action must be taken in order to complete the request
- 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently valid request
Content Negotiation
- Accept-Language: ja
- Return Japanese document
- Accept-Language: en
- Return English document
Others
- Authentication
- Caching
- Header Fields
- Security
Quiz of the day
- Select appropriate statements.
- HTTP takes place over TCP
- HTTP takes place over UDP
- Port number 80 is used mostly
- Port number 25 is used mostly
Homework for master students
- Connect www.is.kochi-u.ac.jp with a telnet client
- Try following requests (and others which you think of)
- OPTIONS * HTTP/1.0
- HEAD / HTTP/1.1
Host: www.is.kochi-u.ac.jp
- HEAD / HTTP/1.0