Starting from:

$30

CSC361-LAB 1: HTTP And WEB SERVER  Solved

                                                                                                                        PROBLEM STATEMENT

In this lab, you will learn the basics of socket programming using TCP connections in Python:

how to create a socket,

bind it to a specific address and port, as well as send and receive a HTTP packet.

You will also learn some basics of HTTP header format.

You will develop a web server that handles one HTTP request at a time. Your web server should accept and parse the HTTP request, get the requested file from the server’s file system, create an HTTP response message consisting of the requested file preceded by header lines, and then send the response directly to the client. If the requested file is not present in the server, the server should send an HTTP 404 Not Found message back to the client. You are also required to implement a simple client in Python after you have completed your server.

HTTP PROTOCOL

 
info.cern.ch
 
If-Modified-Since:
Start CSC361-VM , use telnet into  with port 80 and request the world's first HTML page. Now, do it again with the  header line in your request, so that the server returns a status 304 Not Modified . (Note: Follow the steps shown below.)
 

Determine the IP address of the host that is running the server (e.g., 128.238.251.26 ). Then run a working version of your server program server.py . From another host, open a browser and provide the corresponding URL. For example:

1         http://128.238.251.26:6789/hello.html
hello.html is the name of the file you placed in the server directory, which is also included. Note also the use of the port number after the colon. You need to replace this port number with whatever port you have chosen in your server code. In the above example, we have used the port number 6789 . The browser should then display the contents of hello.html . If you omit :6789 , the browser will assume port 80 and you will get the web page from the server only if your server is listening at port 80 . (This is not recommended.) Then try to get a file that is not present at your server. You should get a 404 Not Found message.

 

RUNNING THE CLIENT

Instead of using a browser, write your own HTTP client to test your server. Your client will connect to the server using a TCP connection, send an HTTP request to the server, and display the server response as an output. You can assume that the HTTP request sent is a GET method. The client should take command line arguments specifying the server IP address or host name, the port at which the server is listening, and the path at which the requested object is stored at the server. The following is an input command format to run the client.

1          client.py 128.338.251.26 6789 hello.html
WHAT TO HAND IN

You will hand in the complete client/server code along with the screen shots of your client. Please verify that you actually receive the contents of the HTML file from the server. Submit your solutions as attachments to Connex.

EVALUATION
 

You must demonstrate your working code inside the CSC361-VM using Wireshark. Using

CSC361-VM
 
not just
127.0.0.x
 
 
 
, the server and the client must use different IP addresses and port numbers, i.e.,

. Your Wireshark demo must capture all related packets, including ARP, TCP

and HTTP. Test your HTTP client/server using the provided hello.html .

You are also required to answer a few questions related to this lab during evaluation in the lab (ECS 360).

Our evaluation scheme is:

(50%) Correctness of Python code

(20%) Wireshark demo

(30%) Questions and Answers (at least 5 questions)
 

More products