GET <B> /<resolver>?<DATA> <B> HTTP/1.0<CRLF> Referer: ... <CRLF> Connection: ... <CRLF> User-Agent: ... <CRLF> Accept: ... <CRLF> <CRLF>You have to deal only the first line. You may ignore all the others.
The tokens have the following meaings:
Whenever httpDNSgateway receives a request, it contacts the primary DNS using UDP/IP, and finds the information there.
httpDNSgateway sets the "recursion desired" bit in the DNS request in accordance with the information provided by user in the html form.
httpDNSgateway is supposed to support queries only. It must support only type A queries (host addresses), of class 1 (Internet). Inverse queries and wildcards are not to be supported.
httpDNSgateway is supposed to support only one request per connection and only one question per client message.
httpDNSgateway uses UDP/IP to communicate with the primary server and must be able to handle communication failures (message losses): httpDNSgateway retransmits the requests to the primary server up to 5 times (timeout between retransmissions is 5 seconds).
httpDNSgateway must be client-misbehavior proof. This means that
httpDNSgateway must not crash if a client misbehaves (e.g. sends wrong
messages, closes connection in the middle of sending the message, does
not read from the socket). httpDNSgateway should close the connection
of misbehaving clients. If a client is idle for more than 2 minutes,
the corresponding socket is to be closed.
The standard port (53) is used for servicing DNS requests, using both
UDP/IP and TCP/IP (we will use UDP/IP). For example, when you use
gethostent call within a program, the corresponding request is sent to the
name server.
The primary zone has all the local information for
mapping local machine-names to IP addresses. In addition, the primary
server knows how to contact higher-zones servers in case it does not
have the requested information.
You can also connect and "talk" to httpDNSgateway using telnet. Another
option is to use wget utility.
You can compare obtained query results with those of UNIX utils dig,
host or nslookup utilities.
Bonus #1: 5 Points
httpDNSgateway must support multiple connections concurrently (i.e.
a second client should not be blocked from connecting to the server
while the first client's request is pending). When multiple clients
request the same name simultaneously, httpDNSgateway does not send multiple
queries to the primary server, but rather waits for the reply from the
server and then sends the answer to all the requesting clients.
The zone's primary server
The domain name server running on the cs network is (see /etc/resolv.conf):
shuldig.cs.huji.ac.il
Library Usage Limitations
Your httpDNSgateway is explicitly forbidden to use any existing
library functions/tools/utilities that handle DNS queries.
However, you may use these utilities for debugging/testing purposes.
Non-blocking mode
httpDNSgateway must
be client-misbehavior proof, therefore, it must operate in non-blocking
mode. httpDNSgateway must take into consideration
that system calls may be interrupted by signals and have to be
repeated.
Testing Your Programs:
You may test your programs by submitting the form. A sample form can be found
here. You have to change
ip and port number in form.html in
order to have the browser send the request to your program. The form
can be submitted using your favorite web browser (e.g., Netscape).
Error Handling:
Relevant RFCs: