ironbark
. It builds on the examples in the
previous prac exercises.First using your Web browser, attempt to open the URL
You should be presented with a username and password dialog box. The username and password for this page are no secret: they're both the string
http://ironbark.bendigo.latrobe.edu.au/subjects/CN/test/index.html
student
. Type this string
into each of the username and password boxes and click the "OK"
button, or whatever your browser calls it. It works? Good.
ironbark
at port 80. Then copy
and paste the following HTTP request, terminated as usual by
two newlines:
Scroll back up the page to view the HTTP headers. You should see an error message like "
GET /subjects/CN/test/index.html HTTP/1.0
HTTP/1.1 401 Authorization Required
".
This means, of course, that to retrieve the page you will need to
submit a valid Authorization:
request header.
This means that when the string
> mimeencode student:student c3R1ZGVudDpzdHVkZW50
student:student
is Base-64 encoded, the result is
c3R1ZGVudDpzdHVkZW50
. So now we can create a new
HTTP request. Once again, telnet to ironbark
at port 80,
and then send the following HTTP request (remember 2 newlines):
Does it work? It should, it did for me.
GET /subjects/CN/test/index.html HTTP/1.0 Authorization: Basic c3R1ZGVudDpzdHVkZW50
telnet
to fetch Web pages by typing in the
bare HTTP commands. Our Unix systems provide three command-line
utilities called GET
, HEAD
and POST
(note uppercase) that we can use to
exercise these protocol methods. So, for example, we could type,
at the Unix command prompt:
This shows both the command typed, and the first few lines of the data returned from the server. The commandline options
> GET http://ironbark.bendigo.latrobe.edu.au/ 200 OK Connection: close Date: Tue, 16 Mar 2004 11:14:13 GMT Accept-Ranges: bytes ETag: "89df2c-1f78-3e2de49a" Server: Apache/1.2.6 Content-Length: 8056 Content-Type: text/html Content-Type: text/html; charset=iso-8859-1 Last-Modified: Mon, 2 Feb 2004 00:23:54 GMT Client-Date: Tue, 16 Mar 2004 11:14:18 GMT Client-Response-Num: 1 Title: The Department of Information Technology at La Trobe University, Bendigo X-Meta-Description: Department of Information Technology Home Page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> ...etc...
-es
tell the GET
program
to print the protocol status lines and the response headers.
Note that we didn't have to
telnet
to ironbark at port 80 -- the
GET
utility looked after all that for us. In
fact, we could consider GET
as a command-line
Web browser...:-)
. You can, of course,
substitute the word HEAD
and see just the
reponse headers, without the need for any commandline options
and without the annoyance of having to scroll all the way back
to the start to view them.
Note the
HEAD http://www.latrobe.edu.au/
Set-cookie:
header. Interesting, huh?
GET
a URL
which has the URL-encoded FORM data appended to the URL, exactly
as described. For the PUT
request you have to
key (or paste) in the URL-encoded data.