120 likes | 138 Views
Dive into understanding HTTP/1.1 protocol semantics to server design nuances. Explore the phases of handling server messages, request methods, response codes, caching proxies, and header modifications.
E N D
HTTP/1.1 and Web Servers • Protocol Semantics • Server Design
Protocol Semantics • Messages • Request • Response • Message subsections • Request • METHOD URI • HEADERS • BODY • Response • STATUS-CODE • HEADERS • BODY
FROM Protocol Semantics to Server Design • Decompose server message handling into phases • Receive request • Parse request • Generate response • Send response • Each phase contains sub-phases • EG. Parse request • Validate message syntax • Log request • Authenticate client • Some sub-phases optional • When studying semantics in HTTP spec, think about which phase(s) and sub-phases(s) would implement semantics. • EG, Content-Length
Request Semantics • Methods • GET • Retrieve URI: can be modified to conditional or partial • HEAD • Retrieve URI’s meta-info • POST • Entity ‘post’ed as a subordinate resource of URI • Diagnostic Methods • OPTIONS • Server list options • TRACE • Echo • Unused Methods • PUT, DELETE
Response Semantics • Response • STATUS • HEADERS • ENTITY • Entity • HEADERS • BODY
Status Codes • Successful 2xx • 200 OK • Redirection 3xx • 301 Moved permanently • 304 Not modified • Client Error 4xx • 400 Bad request • 401 Unauthorized • 404 Not found • Server Error 5xx • 500 Internal server error • 501 Not implemented • 504 Gateway time-out • 505 HTTP version not supported
Other Semantics • Connections • Multiple Req-Resp on a single transport connection
Caching proxies • First proxy caching entity generates response • Protocol issues • Retrieving fresh entities • Strategy • Expiration model • Validation queries • Proxy issues • Memory management mechanisms
HEADERS • Modify messages and entities
Request headers • Accept • Accept-Charset • Accept-Encoding • The media types, charsets, encodings client wants • From • E-mail address • Host • Host:Port of origin server • If-modified-since • Date after which a changed document is wanted • User-Agent
Response Headers • Content-Type • Content-Encoding • Content-Length • Describe a response • Expires • Last-modified • Modification date • Server • WWW-Authenticate
Other Headers • Date • Time message originated • Connection: close • Connection closes after message.