COSC 4377 - Introduction to Computer NetworksSpring 2012MW 1:00-2:30pm at PGH347
Homework 12 : HTTP over DNSDue: midnight April 30, 2012Hard deadline, no extensions or late days In this assignment, we will learn how to tunnel HTTP over DNS. The IdeaAs shown in the picture above, we want to be able to exchange HTTP message. But one of the links above only allows DNS traffic. How can we still enable HTTP protocol between the browser and the web server? The idea is to use encapsulate HTTP messages within DNS messages on the link that only allows DNS. The Proxy server can package the HTTP message into a DNS message and send it to the custom DNS server. The custom DNS server receives the DNS message and extracts the HTTP message from it, then fectches the page using HTTP, and sends it back to the proxy by encoding the HTTP message within a DNS message. Finally, the proxy receives the DNS message, decodes the HTTP message, and sends it to the browser. This encoding and decoding is transparent to the browser, i.e., the browser does not know if the connection between the browser and the webserver is a straight HTTP connection (like in our webserver assignment) or it is going through this encoding and decoding. Required partsYou are welcome to implement the protocol just like what we show in the diagram but we are requiring small pieces of the whole system but still learn about how to run HTTP over DNS. We are requiring these three functionalities:
Implementation GuideThe only way for a DNS client to send a message to a DNS server is a DNS query. Think of a way by which we can send a URL to the custom DNS server as a DNS lookup. You are required to use dig as the DNS client for this part. On the client side, we ask that you create a short script (Perl, Python, or shell script) or a C file with the name dnshttpfetch (or dnshttpfetch.c). Your script or C program should execute the standard dig binary on bayou. If you decide to use a C program to execute dig and parse the output from dig, the binary dnshttpfetch should be created using the Makefile in your folder, i.e., when one types make in the folder it should create two binaries: dnshttpfetch and dnsserver.Once the DNS server knows the URL that the client is interested in fetching, it can use HTTP to connect to the server and download the page. You should be able to reuse your code from HTTP client homework for this part. The only way for a DNS server to a send a message to a DNS client is a DNS reply. Think of a way by which we can have our custom DNS server send a webpage as a valid DNS reply. It is helpful to think about different types of data a server might send to a client in a reply. Your DNS queries and replies must be compliant with RFC 1035. Otherwise dig will complain. TestingWe will execute your DNS server as:./dnsserver -p port For example: ./dnsserver -p 10001 Here we execute the DNS server on port 10001. We will launch dnshttpfetch on bayou as: ./dnshttpfetch port URL Example: ./dnshttpfetch 10001 http://www2.cs.uh.edu/~gnawali/courses/cosc4377-s12/hw12/hello1In the example above, we are telling dnshttpfetch that our custom DNS server is running on port 10001 and we would like to fetch the given URL. The dnshttpfetch script should execute the dig command to send a request, and parse the reply received by dig. It should save three files:
The dnshttpfetch should print to stdout the arguments that it is passing to dig when it executes dig. Example: Executing dig with these arguments: @bayou.cs.uh.edu -p 10005 myname.eduThe dnsserver should print to stdout the request it received from the client and the content of the file after fetching from the web. Example: Received request for URL: http://myname.edu Content of http://myname.edu is: hello world. It is sufficient if your system works with small files, such as the ones pointed to by these URLs:
Questions
SubmissionPlease include a file answers.pdf with answers to the three questions. Please include the source(s) and Makefile in a folder with the name: uhid_hw12, where uhid is the prefix of your .uh.edu email address. Then, zip the directory and upload the zip file using Blackboard. When we unzip your file and type "make" within that folder, it should create an executable called dnsserver. When we type "dnshttpfetch" from inside that folder, the script should execute without any external dependency. Your program must compile and execute on bayou. |