9. Application layer protocols

9.2. GET method

GET is used to request a particular web page from a server. Its syntax looks like this:

GET /xxxxxx.html HTTP/1.1

In addition to the name of the requested resource, it also contains the protocol version used. When the server receives such a message, such a request, it responds to the client with the appropriate message (with the headers shown below) and the requested resource:

HTTP/1.1 200 OK/xxxxxxx.html

The GET request also contains the following information: the host name (e.g. wp.pl), the name of the browser that sent the request, the file types accepted by the browser and the preferred language or character encoding of the page. The server response contains the following information: the server time, the name of the server application (e.g. APACHE) or the expiry time of the document.

If, for some reason, the web server cannot send back the resource, it sends back an error message, such as 404 notifying that the requested resource was not found or 403 notifying that access to the resource is prohibited. 

Selected messages and error codes:

Code - Description - Meaning

400 - Bad Request - The server could not process the request due to a client error

401 - Unauthorised requests - Requests for resources that require authentication

403 - Forbidden - The server understands the request, but the security configuration prevents it from returning the requested resource

404 - Not Found - The server could not find a resource at the specified URL

405 - Method not allowed - The method contained in the request is not allowed for the indicated resource

406 - Not Acceptable - The requested resource cannot return a response that the client can handle

407 - Proxy authentication required - Proxy authentication required

408 - Request timeout - Request timeout elapsed: client did not send request to server within specified time period

409 - Conflict - The request could not be fulfilled due to a conflict with the current state of the resource

411 - Length requested - server refused to complete request due to missing Content-Length header in request

Server error code:

Code - Description - Meaning

500 - Internal Server Error - The server has encountered a problem that prevents it from completing the request

501 - Not Implemented - The server does not have the capabilities required for the query

502 - Invalid gateway error - The server - acting as a gateway or intermediary - received a bad response from the host server and could not fulfill the client's request

503 - Service unavailable - The server is currently unable to complete the client's request due to overloading

504 - Gateway Timeout Exceeded - The server acting as a gateway or intermediary did not receive a response from the specified HTTP, FTP, LDAP, etc. server within the specified time or a DNS server is required to handle the request

505 - HTTP Version Not Supported - The server does not support or refuses to support the HTTP version specified by the client