Sun Java System Web Proxy Server 4.0.11 NSAPI Developer's Guide

Server Responses

The server’s response includes the following information:

HTTP Protocol Version, Status Code, and Reason Phrase

The server sends back a status code in response to a request, which is a three-digit numeric code. The five categories of status codes are:

The following table lists some common status codes.

Table 8–2 Common HTTP Status Codes

Status Code  

Meaning  

200

Request has succeeded for the method used (GET, POST, HEAD).

201

The request has resulted in the creation of a new resource reference by the returned URI. 

206

The server has sent a response to byte-range requests. 

302

Found. Redirection to a new URL. The original URL has moved. This code is not an error because most browsers will get the new page. 

304

Use a local copy. If a browser already has a page in its cache, and the page is requested again, some browsers, such as Netscape Navigator, relay to the web server the “last-modified” timestamp on the browser’s cached copy. If the copy on the server is not newer than the browser’s copy, the server returns a 304 code instead of returning the page, reducing unnecessary network traffic. This code is not an error. 

400

Sent if the request is not a valid HTTP/1.0 or HTTP/1.1 request. For example HTTP/1.1 requires a host to be specified either in the Host header or as part of the URI on the request line.

401

Unauthorized. The user requested a document but didn’t provide a valid user name or password. 

403

Forbidden. Access to this URL is forbidden. 

404

Not found. The document requested isn’t on the server. This code can also be sent if the server has been instructed to send this response to unauthorized user. 

408

If the client starts a request but does not complete it within the keep-alive timeout configured in the server, then this response will be sent and the connection closed. The request can be repeated with another open connection. 

411

The client submitted a POST request with chunked encoding, which is of variable length. However, the resource or application on the server requires a fixed length - a Content-Length header to be present. This code tells the client to resubmit its request with content-length.

413

Some applications, for example, certain NSAPI plug-ins, cannot handle very large amounts of data, so these applications will return this code. 

414

The URI is longer than the maximum the web server is willing to serve. 

416

Data was requested outside the range of a file. 

500

Server error. A server-related error occurred. The server administrator should check the server’s error log. 

503

Sent if the quality of service mechanism was enabled and bandwidth or connection limits were attained. The server will then serve requests with that code. See the "quality of service" section. 

Response Headers

The response headers contain information about the server and the response data.

The following table lists some common response headers.

Table 8–3 Common Response Headers

Response Header  

Description  

Server

Name and version of the web server 

Date

Current date (in Greenwich Mean Time) 

Last-Modified

Date when the document was last modified 

Expires

Date when the document expires 

Content-Length

Length of the data that follows (in bytes) 

Content-Type

MIME type of the following data 

WWW-Authenticate

Used during authentication and includes information that tells the browser software what is necessary for authentication such as user name and password. 

Response Data

The server sends a blank line after the last header. The server then sends the response data such as an image or an HTML page.