Lab 5 - Lab 5: Building a HTTP Server IMPORTANT: Your web...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 5: Building a HTTP Server IMPORTANT: Your web server should be able to serve HTTP files only. You will not need to implement the directory listing and CGI-bin like it has been done in previous semesters. Purpose of the Lab The objective of this lab is to implement a HTTP server that will allow a HTTP client (a web browser like FireFox or Internet Explorer ) to connect to it and download files. HTTP Protocol Overview A HTTP client issues a `GET' request to a server in order to retrieve a file. The general syntax of such a request is given below : GET <sp> <Document Requested> <sp> HTTP/1.0 <crlf> {<Other Header Information> <crlf>}* <crlf> where : <sp> stands for a whitespace character and, <crlf> stands for a carraige return-linefeed pair. i.e. a carriage return (ascii character 13) followed by a linefeed (ascii character 10). <crlf><crlf> is also represented as "\n\n". <Document Requested> gives us the name of the file requested by the client. As mentioned in the previous lab, this could be just a backslash ( / ) if the client is requesting the default file on the server. {<Other Header Information> <crlf>}* contains useful ( but not critical ) information sent by a client. These can be ignored for this lab. Note that this part can be composed of several lines each seperated by a <crlf> . * - kleene star // regular expressions Finally, observe that the client ends the request with two carriage return linefeed character pair: <crlf><crlf> The function of a HTTP server is to parse the above request from a client, identify the file being requested and send the file across to the client. However, before sending the actual document, the HTTP server must send a response header to the client. The following shows a typical response from a HTTP server when the requested file is found on the server: HTTP/1.0 <sp> 200 <sp> Document <sp> follows <crlf> Server: <sp> <Server-Type> <crlf> Content-type: <sp> <Document-Type> <crlf> {<Other Header Information> <crlf>}*
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
<crlf> <Document Data> where : <Server-Type> identifies the manufacturer/version of the server. For this lab, you can set this to CS 290 lab3.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/30/2012 for the course CS 252 taught by Professor Gustavorodriguez during the Fall '11 term at Purdue.

Page1 / 5

Lab 5 - Lab 5: Building a HTTP Server IMPORTANT: Your web...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online