DOC PREVIEW
Berkeley ELENG 122 - Project 1: Build a Web Server

This preview shows page 1-2 out of 6 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EE122 Introduction to Computer Networks Fall 2007 Project 1 Build a Web Server Milestone 1 DUE SEPT 26 2007 11PM Vern Paxson Lisa Fowler Daniel Killebrew Jorge Ortiz Introduction The goal of this project is to build a functional server and client for a subset of HTTP version 1 0 Your server will be able to serve content to web browsers and clients anywhere in the world Similarly your web client will be able to receive content from any web server This project will teach you the basics of distributed programming and client server architectures and allow you to gain a functional understanding of the HTTP protocol This effort will be broken down into smaller stages and will be due in two milestones This is the project description for the first milestone At a high level a web server is simply a program that listens for connections on a particular socket bound to a specific port on the server receives commands from clients via this socket processes the commands and sends the results of the processing back to the client as a response to the command In this abstract view of a web server a server is a program that executes a logically infinite loop wherein it receives and processes commands structured something like the following Loop forever Listen for incoming connections Accept new client connection Parse HTTP 1 0 request Ensure well formed request return error otherwise Determine if target file exists and if permissions are set properly return error otherwise Transmit contents of file to client by performing reads on the file and writes on the socket Close the connection For this milestone you will create both a web server that behaves as described above along with a client to interface with any web server using HTTP 1 0 Milestone 1 Client Server Beginning HTTP The goal of this project is to learn socket programming for both clients and servers There are two halves to this milestone You may approach this milestone by starting from either half but it is essential that you complete both halves 1 Part A Client Server System The client server model is a very common way to build network applications For the first step in this project you will build a client program that sends user input to a server program that echoes the data back to the client Note that in this initial step the application layer protocol is trivial the server just copies whatever bytes it receives back to the client without parsing them in any fashion You will extend this in the next step but for now no additional processing is required Client Specifications 1 The client should compile to a binary called http client and will be executed using the command http client server port where server and port indicate the appropriate port on the particular server to which you wish to connect In particular your client should be able to connect to the server at ilinux3 eecs berkeley edu TCP port 7788 run by the EE122 staff Note an announcement will be sent when this server is available for testing 2 The client program reads lines from the keyboard stdin accepting input up to 2048 B in size 3 After the user enters one line the client sends this line to the server 4 The client outputs the data received from the server to the console stdout 5 The client repeats the above steps until it is killed with a Ctrl C or stdin is closed user enters end of file Ctrl D 6 The client uses TCP to communicate with the server 7 The client must gracefully handle error conditions For example the server might not be running might not respond to you or might unexpectedly close the connection Server Specifications 1 The server should compile to a binary called http server and will be executed using the command http server port wherein port is the port number to listen on 2 The server listens for TCP connections on a port specified as a command line argument on startup 3 The server echoes back the first line it receives on the TCP connection prints the line to standard output and prints the components of the request or prints an appropriate error for invalid requests 4 The server closes the connection with the client 5 The server must be able to handle concurrent connections from multiple clients This will entail use of select as will be discussed in section The server cannot wait on a single client to finish sending while ignoring the other clients Both your client and server programs should be prepared to deal with socket related errors and attempt to recover from the errors when possible Your program should be able to handle basic socket errors such as one side of the connection closing the connection unexpectedly or a client being unable to connect to a server If a client or server encounters a socket error it should print a meaningful error message to standard error If the client or server is unable to recover from the socket error it should terminate 2 Part B Beginning HTTP i e Doing Useful Work Part A of this milestone focuses on the network interface between a client and a server Here we turn to the higher level logic that will allow us to do useful work with our client server system in the future The task in this part of the milestone has nothing to do with networking and is simply a parsing problem Grammar for HTTP 1 0 GET For this part you are to write a program that will determine if a command received by a server is a valid HTTP GET command An HTTP GET command is simply a line of input that looks like the following GET Research Areas OSNT index html HTTP 1 0 The HTTP GET request is part of the larger HTTP protocol Protocols such as HTTP are typically specified using a precise specification notation in the form of an augmented Backus Naur Form BNF grammar These notations are in essence a textual form of the syntax diagrams that are used to specify the formal syntax of a programming language For example the formal definition of the HTTP GET request line that you are to implement is given by the following grammar Request Line Method Method Space Request URI Space HTTP Version Space CRLF GET Request URI Absolute Path FileNameChar Absolute Path FileNameChar ALPHA DIGIT HTTP Version HTTP DIGIT DIGIT Space SP TAB The additional tokens and terminals are described in section 2 2 Basic Rules in RFC 1945 1 We have left out some of the full syntax For example in reality FileNameChar can include escape sequences and alternate character encodings Note Anything in quotes is interpreted as a string literal and must appear exactly as described The vertical


View Full Document

Berkeley ELENG 122 - Project 1: Build a Web Server

Documents in this Course
Lecture 6

Lecture 6

22 pages

Wireless

Wireless

16 pages

Links

Links

21 pages

Ethernet

Ethernet

10 pages

routing

routing

11 pages

Links

Links

7 pages

Switches

Switches

30 pages

Multicast

Multicast

36 pages

Switches

Switches

18 pages

Security

Security

16 pages

Switches

Switches

18 pages

Lecture 1

Lecture 1

56 pages

OPNET

OPNET

5 pages

Lecture 4

Lecture 4

16 pages

Ethernet

Ethernet

65 pages

Models

Models

30 pages

TCP

TCP

16 pages

Wireless

Wireless

48 pages

Load more
Download Project 1: Build a Web Server
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Project 1: Build a Web Server and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Project 1: Build a Web Server and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?