Networks, Spring 2018, Lab 1 (first part of homework 1)
You can work alone if you wish, but I recommend you work with a partner. Part A: a simple webserver
In this lab, you’ll take preexisting code implementing a very trivial webserver and deploy it live (temporarily) on your own machine or a lab machine. Now, your webserver won’t actually be accessible from web browsers running on machines other than the one it’s running on, but hey, it’s a start!
Here’s what you’ll do:
1) Download the source code files WebServer.java and HttpRequest.java from the Resources tab in Piazza, and read through the code and the comments, trying to understand what it’s doing.
2) Now you can test to see whether your webserver actually works by opening a browser and entering address localhost, which automatically refers to your own machine.
a. What should be happen when you do this if it is working correctly?
b. Why isn’t it working? A: you didn’t specify a port number.
3) With a port number, what should localhost by itself do? How can you get it
to return a file that actually exists?
Now your webserver should work correctly under both scenarios, both when there is a valid existing filename specified in the address, and when there isn’t.
Part B: hand-submitting HTTP requests
Consider the following HTTP request commands: telnet cis.poly.edu 80
GET /~ross/ HTTP/1.1 Host: cis.poly.edu
(or replace telnet with nc -c -t on new macs)
1. Is this case-sensitive?
2. What happens if you dom’t use this case for the GET?
3. Or for the HTTP?
4. Or for the Host?
5. How do you the lehman.edu webpage?
(To get back to the command prompt, press Ctrl+c if necessary.)
6. What happens if you leave out the Host line? (Why?)
7. What happens if you put the wrong thing in the Host line (i.e., a host different from the one you telnetted to)? (Why?)
What to hand in:
1) The source files WebServer.java and HttpRequest.java (if you made any changes to them)
2) a screenshot showing the webserver’s behavior in your browser when there’s a valid file
3) a screenshot when there isn’t
4) written (meaning typed) answers to the part B questions
Both screenshots should clearly show the url of course.
How to submit:
Via Piazza. There will be an announcement posted there with detailed instructions.
If you work with a partner, one of you can submit a single copy of your work, labeled with both your names.
TO GET THIS OR ANY OTHER ASSIGNMENT DONE FOR YOU FROM SCRATCH, PLACE A NEW ORDER HERE