Java Reference
In-Depth Information
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Style-Type: text/css
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8
The list of legal commands is found in the Allow field. However, in practice these are
just the commands the server understands, not necessarily the ones it will actually per‐
form on that URL.
TRACE
The TRACE request method sends the HTTP header that the server received from the
client. The main reason for this information is to see what any proxy servers between
the server and client might be changing. For example, suppose this TRACE request is sent:
TRACE /xml/ HTTP/1.1
Hello: Push me
Host: www.ibiblio.org
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: close
The server should respond like this:
HTTP/1.1 200 OK
Date: Sat, 04 May 2013 14:41:40 GMT
Server: Apache
Connection: close
Content-Type: message/http
TRACE /xml/ HTTP/1.1
Hello: Push me
Host: www.ibiblio.org
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: close
The first five lines are the server's normal response HTTP header. The lines from
TRACE /xml/ HTTP/1.1 on are the echo of the original client request. In this case, the
echo is faithful. However, if there were a proxy server between the client and server, it
might not be.
Disconnecting from the Server
HTTP 1.1 supports persistent connections that allow multiple requests and responses
to be sent over a single TCP socket. However, when Keep-Alive is used, the server won't
immediately close a connection simply because it has sent the last byte of data to the
client. The client may, after all, send another request. Servers will time out and close the
connection in as little as 5 seconds of inactivity. However, it's still preferred for the client
to close the connection as soon as it knows it's done.
Search WWH ::




Custom Search