1.Uses a socket object to open a socket connection to “www.google.com” on port 80.
2. Constructs a PrintWriter and a BufferedReader from the socket
3. Sends a HTTP request for the page “www.google.com”.
If your PrintWriter is called “out” then you could, for instance use the
out.write("GET /~rdb/page/index.html \n");
However a well-formed HTTP GET request could be much longer.

In the above statement, what does well formed HTTP GET request mean?
Can anyone pass on a hint?

Recommended Answers

All 3 Replies

I think well-formed just means it is correct in its syntax etc.

I think well-formed just means it is correct in its syntax etc.

It will obviously be correct in syntax.
What was asked is " Instead of retrieving the web page using GET "/~RDB/..." it could be extended to several lines.

A full HTTP request would look like this:

GET /file/loc/here.html HTTP/1.1
Host: www.example.org
User-Agent: Mozilla/5.0 (Windows;en-GB; rv: Gecko/20070312 Firefox/
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.somewebsite.com/example.html

Which, of course, is longer - that is, I think, what the question was saying.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.