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

Info icon This 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>}*
Image of page 1

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

View Full Document Right 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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern