Exercise 2. Understand HTTP 1.1 usig fake web server and web client.
In this exercise, you will first run a fake web serve using
~cs522/bin/ws to find out the http request sent by a browser. Then we will
use telnet <domainname> <portno> as a fake browser to find out
what is the http resposne of a web server.
If we type in ~cs522/bin/ws 9338 on blanca.uccs.edu, then type in http://blanca.uccs.edu:9338/~cs401/ on a IE browser. We will see the following message on the console. The message received is the http request sent by the browser with http request command link "GET /~cs401/ HTTP/1.1" followed by 6 headers lines.
All header lines has header name followed by ":"
then by the value of the header.
The Accept header indicates the type of file format accepted by the browser.
The Accept-Language header is en-us. It can be by the server to return the
US English version of the web page.
The Accept-Encoding indicates the acceptable compression method.
The Use-Agent meta header indicates the versionof the browser that submitted
the request. It may include the related OS version, SSL package number. Here
it shows the browser is MS IE version 6.0 running on a machine with NT5.1
OS (XP).
To comply with HTTP/1.1 protocol, the browser needs to supply the Host header
with the domain name and port number in the url entered by the user. Here
it is blanca.uccs.edu:9338.
Connection header has value Keep-Alive, which means the browser requests the
TCP connection to be kept alive for future http request. This feature reduces
the 3-way handshake overhead for those future requests.
blanca.uccs.edu> ~cs522/bin/ws
9338
ws 9338
argv[1]=9338
portno=9338
before getsockname socket has port #9338
socket has port #9338
rcvd msg-->GET /~cs401/ HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash,
*/*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;
.NET CLR 1.0.2914; .NET CLR 1.1.4322)
Host: blanca.uccs.edu:9338
Connection: Keep-Alive
What is your reply ("#" to end multilineinput; "$" to
break connection)?
HTTP/1.1 200 OK
Date: Mon, 18 Aug 2003 22:25:16 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Last-Modified: Sun, 17 Aug 2003 18:06:53 GMT
ETag: "b4dc6a-3866-c01bc940"
Accept-Ranges: bytes
Content-Length: 18
<html>OHHHH</html>
The above interaction shows that when the fake web ask "what is your reply?" We type in the http response (pretend we are the web server). The First line is the http response line. The 200 is the response code, which indicate the web page is retrieve successfully. The remaining six headers indicate
Date: the date the response is created,
Server: the version of the server that returns the response
Last-Modified: indicates the web page last modified date
ETag: A hash value can be submitted in the future for verifying the version
of document has been updated.
Accept-Range: bytes (HTTP1.1 only support bytes. A http request can use Range
header to request portion of a document.)
Content-Length: indicates the the length of the attached document after the
http response header. Here it is 18 bytes.
Note the the header and body are separated by two CRLF after the last http
header.
Use CS Unix machines or a Unix machine to carry the following exercise. The windows commond console will not take the following telnet command to port 80. Note that the web page last modified date was changed to 28 Oct 2003 instead 17 Aug 2003.
The following are the response of a web server capatured using "telnet
cs.uccs.edu 80 > out.txt " and enter
GET / HTTP/1.0
<enter>
<enter>
Trying 128.198.162.68...^M
Connected to cs.uccs.edu.^M
Escape character is '^]'.^M
HTTP/1.1 200 OK
Date: Mon, 18 Aug 2003 22:25:16 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Last-Modified: Sun, 17 Aug 2003 18:06:53 GMT
ETag: "b4dc6a-3866-c01bc940"
Accept-Ranges: bytes
Content-Length: 14438
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="C. Edward Chow">
<meta name="GENERATOR" content="Mozilla/4.7 [en] (WinNT;
I) [Netscape]">
<title>CS522 F2003 Home Page</title>
</head>
<body background="marble1.jpg">
Exercise 3 Web Page with Form.
blanca.uccs.edu>
cd ~cs522/bin
blanca.uccs.edu>
ws 8352
argv[1]=8345
portno=8345
before getsockname socket has port #8345
socket has port #8345
rcvd msg 348 bytes-->
POST /cgi-bin/cs522/processOrder.pl HTTP/1.0
Referer: http://blanca.uccs.edu/~cs522/hw/hw1/orderForm.html
Connection: Keep-Alive
User-Agent: Mozilla/4.7 [en] (WinNT; I)
Host: blanca.uccs.edu:8345
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
*/*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
What is your reply ("$" to break connection)?
rcvd msg 351 bytes-->
Content-type: application/x-www-form-urlencoded
Content-length: 277
butter=1&chocolate=1&mint=3&mm=5&peanut=0&name=C.+Edward+Chow&email=chow%40cs.uc
cs.edu&telephone=%28719%29262-3110&creditCardType=Visa&creditCardNo=3333+2222+44
44+5555&expireDate=02%2F02&shippingAddress=ENS+186%0D%0AUCCS%0D%0AColorado+Springs%2C+CO+80918%0D%0AUSA&.submit=order
What is your reply ("$" to break connection)?
Exercise 4 Ethereal Packet Sniffing Exercise.