Skip to content

27. HTTP Header, GET/POST/HEAD, HTTP Status Codes

March 10, 2011

79. What kind of data is passed via HTTP headers?
Both HTTP requests and HTTP responses use headers to send information about the HTTP message. A header is a series of lines, with each line containing a name followed by a colon, a space and then a value. The fields can be arranged in any order. Some header fields are used in both request and response headers, while others are appropriate only for either a request or a response. Many request header fields will allow the client to specify several acceptable options in the value part and, in some cases, even rank each option’s preference. Multiple items are separated using a comma. For example, a client could send a request header that includes “Content-Encoding: gzip, compress,” indicating it would accept either type of compression. If the server uses gzip encoding for the response body, its response header would include “Content-Encoding: gzip”. Some fields can occur more than once in a single header. For example , a header can have multiple “Warning” fields.
Response Header Example
HTTP/1.1 200 OK
Server: Microsoft-IIS/7.5
Date: Thu, 10 Mar 2011 08:15:53 GMT
Content-Length: 2291
Content-Type: text/html
Cache-control: private


80. Juxtapose the HTTP verbs GET and POST. What is HEAD?
HTTP GET requests a representation of a specified resource. Requests using GET should not have the significance of taking an action, other than retrieval. HTTP GET enables to send the entire request, along with any required parameters, all contained within the URL submission. Any parameters that are sent along using HTTP GET can only be in a name/value pair construction – also known as a querystring.
HTTP POST submits data to be processed(e.g from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updating of a resource, or both. HTTP POST is similar to HTTP GET in that name/value pairs are sent to the server for processing. The big difference is that HTTP POST places the name/value pairs within a request header so they are not visible; HTTP GET sends these same items within a viewable open URL string.
HTTP Head asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta information written in response headers, without having to transport the entire content.

81. Name and describe at least half a dozen HTTP Status Codes and what they express to the requesting client.
1xx: Information
100: request continue
101: switch protocols
2xx: Success
200: ok
201: created
202: accepted
203: partial
3xx: Multiple Choices
300: ambiguous
301: moved
302: redirect
303: redirect method
4xx: Errors
400: bad request
401: status denied
403: forbidden
404: not found
405: bad method
406: none acceptable
5xx: Server Error
500: server error
501: not supported
502: bad gateway
503: service unavailable
504: gateway timeout
505: status version not supported

Happy Programming! =)

Source: mainly MSDN,


From → OOP

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: