Building and Managing Web Sites HTTP Fundamentals Server
Building and Managing Web Sites HTTP Fundamentals Server Fundamentals 1
HTTP Introduction • HTTP -- Hypertext Transfer Protocol • HTTP is the protocol that WWW requests are based upon. • Standard maintained by W 3 C at http: //www. w 3. org/Protocols/ • HTTP specification defines how client requests content from a server and how a server returns a response to the client. Server Fundamentals 2
HTTP Introduction • Two different versions, 1. 0 and 1. 1 • Version 1. 1 more efficient with larger pages. • HTTP supports many request types: – PUT and DELETE not commonly used – GET and POST are primary types. Server Fundamentals 3
Web Server Fundamentals A webserver is software that does the following: • Server receives requests from browser/client for resources – A resource is any chunk of information that can be identified by a URL like HMTL or image files, scripts, streaming media, etc. • • Server retrieves and/or processes the resource Server sends the resource back to the client Server logs the transaction Responses/requests occur using the HTTP protocol, typically on port 80 Server Fundamentals 4
Sample HTTP Exchange To retrieve the resource at http: //www. host. com/path/file. html Browser sends request to host www. host. com, port 80: GET /path/file. html HTTP/1. 0 From: 105. 123. 456. 789 User-Agent: Mozilla/4. 01 The server sends a response back to the client: HTTP/1. 0 200 OK Date: Fri, 31 Dec 1999 23: 59 GMT Content-Type: text/html Content-Length: 1354 <html><body><h 1>Happy New Millenium!</h 1> (more file contents) </body> </html> Server Fundamentals 5
Response Status Line • Includes three parts separated by spaces – the HTTP version – a response status code that gives the result of the request – An English reason phrase describing the status code. • Typical status lines are: HTTP/1. 0 200 OK or HTTP/1. 0 404 Not Found Server Fundamentals 6
Common Response Status Codes • 200 OK - Request succeeded, resulting resource is returned in the message body • 404 Not Found --The requested resource doesn't exist. • 301 Moved Permanently • 302 Moved Temporarily • 303 See Other (HTTP 1. 1 only) Resource has moved to another URL (given by the Location: response header), and should be automatically retrieved by the client. • 500 Server Error -- Unexpected server error. Common caused by a server-side script that has bad syntax, fails, or otherwise can't run correctly. Server Fundamentals 7
Response “Content-Type” • Response header includes “Content-Type” to tell client/browser how to handle the resource (display a browser or launch an application/plug-in) • Based on MIME types for email attachments • Broad types: text, image, audio, video, application • Many different subtypes, always new ones. • E. g. , Content-Type: text/html • Most webservers software have a list of common types – must define new subtypes on webserver Server Fundamentals 8
Front. Page and HTTP • Front. Page uses the HTTP commands PUT and DELETE • Front. Page can be sensitive to Proxy Servers that intercept HTTP requests. • Can also attach via FTP. Server Fundamentals 9
- Slides: 9