|
|
|||||||||||||||
last updated on 4/13/2011 12:32:31 PM |
HTTP/1.0 vs. HTTP/1.1
Overview of status codes supported by the different HTTP versions. Take care about the capabilities of
the Web browser and server.
HTTP/1.0 (RFC1945) HTTP/1.1 (RFC2068) - 100 Continue - 101 Switching Protocols 200 OK 200 OK 201 Created 201 Created 202 Accepted 202 Accepted - 203 Non-Authoritative Information 204 No Content 204 No Content - 205 Reset Content - 206 Partial Content - 300 Multiple Choices 301 Moved Permanently 301 Moved Permanently 302 Moved Temporarily 302 Moved Temporarily - 303 See Other 304 Not Modified 304 Not Modified - 305 Use Proxy 400 Bad Request 400 Bad Request 401 Unauthorized 401 Unauthorized - 402 Payment Required 403 Forbidden 403 Forbidden 404 Not Found 404 Not Found - 405 Method Not Allowed - 406 Not Acceptable - 407 Proxy Authentication Required - 408 Request Timeout - 409 Conflict - 410 Gone - 411 Length Required - 412 Precondition Failed - 413 Request Entity Too Large - 414 Request-URI Too Long - 415 Unsupported Media Type 500 Internal Server Error 500 Internal Server Error 501 Not Implemented 501 Not Implemented 502 Bad Gateway 502 Bad Gateway 503 Service Unavailable 503 Service Unavailable - 504 Gateway Timeout - 505 HTTP Version Not Supported
Informational 1xx
This class of status code indicates a provisional response,
consisting only of the Status-Line and optional headers, and is
terminated by an empty line. Since HTTP/1.0 did not define any 1xx
status codes, servers MUST NOT send a 1xx response to an HTTP/1.0
client except under experimental conditions.
100 Continue
To reproduce a 100 Continue status code both - the client and the server - MUST support HTTP/1.1.
Just POST some content (request body) to the server.
101 Switching Protocols
Successful 2xx
Nothing happens when using Netscape Communitcator 4.7
The server has fulfilled the partial GET request for the resource.
The request must have included a Range header field
indicating the desired range.(*) The response MUST include either a
Content-Range header field indicating the range
included with this response, or a multipart/byteranges Content-Type
including Content-Range fields for each part. If multipart/byteranges
is not used, the Content-Length header field in the response MUST
match the actual number of OCTETs transmitted in the message-body.
A cache that does not support the Range and Content-Range headers
MUST NOT cache 206 (Partial) responses.
(*) This can't be recorded with a Web browser, 'cause there's no opportunity to
include such a header. Use "WebHeaderAdd" in the SilkPerformer script as workaround.
Example - the first 100 bytes:
HTTP request header:
SilkPerformer script:
This class of status code indicates that the client's request was
successfully received, understood, and accepted.
200 OK
201 Created
The following ASP creates a resource and responds with a "201 Created".
The URL of the created resource can be found in the location header.
202 Accepted
203 Non-Authoritative Information
204 No Content
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.
205 Reset Content
206 Partial Content
Range: bytes=0-99
WebHeaderAdd("Range", "bytes=0-99");
Redirection 3xx
No "Location"-header:
This class of status code indicates that further action needs to be
taken by the user agent in order to fulfill the request. The action
required MAY be carried out by the user agent without interaction
with the user if and only if the method used in the second request is
GET or HEAD. A user agent SHOULD NOT automatically redirect a request
more than 5 times, since such redirections usually indicate an
infinite loop.
300 Multiple Choices
The requested resource corresponds to any one of a set of
representations, each with its own specific location, and agent-
driven negotiation information (section 12) is being provided so that
the user (or user agent) can select a preferred representation and
redirect its request to that location.
301 Moved Permanently, 302 Moved Temporarily and 303 See Other
304 Not Modified
305 Use Proxy
The requested resource MUST be accessed through the proxy given by
the Location field. The Location field gives the URL of the proxy.
The recipient is expected to repeat the request via the proxy.
Additional Samples
Check redirection:
The form's action URL(status_checkRedirect.asp) redirects to the selected host/url (another asp called status_checkedRedirect.asp) and passes the url of the target in the querystring. The redirection target takes the passed url and compares it with its location.
Multiple Redirections (I):
This ASP produces multiple redirections.
Multiple Redirections (II):
This one produces multiple redirections; the urls to redirect to contain a query string (number=1, number=2).
Redirect for ever:
The browser MUST NOT redirect more than 3 times:
Click to check.
Redirect to a bookmark:
Click to redirect to top of Redirection 3xx.
Multiple Redirection with Authentication:
Click to experience the follwing:
Request status_authRedir0.asp?LOGON_USER=BasicAuthUser on host demo.borland.com. This document demands authentication (BasicAuthUser/BasicauthPass) and redirects you to status_authRedir1.asp?LOGON_USER=BasicAuthUserA on host demo.borland.coma.
status_authRedir1.asp?LOGON_USER=BasicAuthUserA on host demo.borland.coma again demands authentication (BasicAuthUserA/BasicauthPassA) and redirects you to status_authRedir2.asp?LOGON_USER=BasicAuthUserB on host demo.borland.comb.
status_authRedir2.asp2LOGON_USER=BasicAuthUserB on host demo.borland.comb again demands authentication (BasicAuthUserB/BasicauthPassB) and finally shows a summary.
Redirection's Location URL:
Following problem occured in SP3.5/SP3.5.1:
Every redirection's Location URL is not scripted when directly acessed (GET, POST) afterwards.
The following sample redirects to data2html.asp. Press reload and check if the request is scripted.
Client Error 4xxx
A Proxy Server is required to reproduce a 407 Proxy Authentication Required status code.
Not supported by Netscape Communitcator 4.7
The 4xx class of status code is intended for cases in which the
client seems to have erred. Except when responding to a HEAD request,
the server SHOULD include an entity containing an explanation of the
error situation, and whether it is a temporary or permanent
condition. These status codes are applicable to any request method.
User agents SHOULD display any included entity to the user.
The Netscape Proxy Server 3.5 on lab13:8080 is configured to
demand an authentication (407 Proxy Authentication Required) on following URLs:
http:///status_407.asp
http:///status_407.asp
Server Error 5xx
Response status codes beginning with the digit "5" indicate cases in
which the server is aware that it has erred or is incapable of
performing the request. Except when responding to a HEAD request, the
server SHOULD include an entity containing an explanation of the
error situation, and whether it is a temporary or permanent
condition. User agents SHOULD display any included entity to the
user. These response codes are applicable to any request method.
Load Balancing
This sample redirects randomly to a page in one
of multiple different subdirectories.
Redirections as load balancer:
The images one the redirection target page are displayed using JavaScript.