Status line:It contains :1.
HTTP versionEx. HTTP /1.12.status codeEx.:2023.reason phraseEx: acceptedEx: HTTP/1.1 202 AcceptedC. Response Header:The response-header fields allow the server to pass additional information about the response which cannot be placed in the Status- Line.
These header fields give information about the server and about further access to the resource identified by the Request-URI.A list of some important Request-header fields:? Accept-Ranges? Age? ETag? Location? Proxy-Authenticate? Retry-After? Server? Vary? WWW-AuthenticateD. Message Status-line:A Status-Line consists of the protocol version followed by a numeric status code and its associated textual phrase.
Example of Response Message:HTTP/1.1 200 OKDate: Mon, 27 Jul 2009 12:28:53 GMTServer: Apache/2.2.14 (Win32)Last-Modified: Wed, 22 Jul 2009 19:15:56 GMTContent-Length: 88 Content-Type: text/htmlConnection: closeHttp Request Code:This is a list of Hypertext Transfer Protocol (HTTP) response status codes. Status Code are issued by a server response into browser’s request made to the server. HTTP includes from IETF Request for Comment(RFC) other some additional codes is used in HTTP.First digit of status code indicates one of five standard classes of response. It’s message phrases are shown typical, but human readable alternatively may be provided.
IANA maintains the official registry of HTTP status code.HTTP is a one type of integer code, which include three-digit code, indicates the result of request.1xx (Informational):This response suggests that the request has been taken by the processor and process is under progress.
100 Continue:The status code 100 indicates that the initial part of the request has not yet been rejected from the server and the server will send the final response to the client after the request has been fully received.101 Switching Protocol:The status code 101(Switching Protocol) indicates that the client has request to the server to switch the protocols and the server machine has accepted to do that.2xx (Successful):These codes indicate success. The body section if present is the object returned by the request.
It is a MIME format object. It is in MIME format, and may only be in text/plain, text/html or one for the formats specified as acceptable in the request.200 Ok:The status code 200(Ok) indicates that the action has succeeded and the payload has been sent in 200 response which is depends on request method.201 Created:The status code 201(Created) indicates that the request is fulfilled and fully accepted, and new resource will be created.202 Accepted:The status code 202(Accepted) indicates that the action is completely accepted for processing from server side but the processing is not yet completed.
203 Not Authoritative Information (Partial Information):The status code 203(Not Authoritative Information) indicates that the entity header information is third-party copy or from local server, not from the original server.When received in the response to a GET command, this indicates that the returned meta information is not a definitive set of the object from a server with a copy of the object, but is from a private overlaid web. This may include annotation information about the object204 No Content (No Response):The status code 204(No Content) and a header are given in the response, but there is no indication body in the response.Server has received the request but there is no information to send back, and the client should stay in the same document view205 Reset Content:The status code 205(Reset Content) indicates that the used form for this transaction for additional input in the browser.
206 Partial Content:The status code 206(Partial Content) indicates that the server is returning the partial data of the size requested from client.3xx Redirection:In this class the remaining action must be taken for completing the request.300 Multiple Choices:The status code 300(Multiple Choices) will display the link list and from them the client can select a link and go to the expected location or destination. Maximum five addresses could display.301 Moved Permanently: The HTTP response status code 301 Moved Permanently is used for permanent URL redirection, that means current links or records using the URL that the response is received for should be updated.
The new URL should be provided in the Location field included with the response. The 301 redirect is considered a best practice for upgrading users from HTTP to HTTPS.Example:GET / first.php HTTP/1.1Host: www.
google .co.inServer Response:HTTP/1.1 301 Moved PermanentlyLocation: http://www.google.co.in/first.
php302 Found:This Status Code is a Common Way of performing URL Redirection.Example:GET / Second.php HTTP/1.1Host: www.google .co.inServer Response:HTTP/1.1 302 Not Found301 Moved PermanentlyLocation: http://www.
google.co.in/Second.php303 See Other:This status code 303 means See Other indicate the requests page will be display under any new or different URL in the browser. That code run after HTTP POST Method has been performed. 303 used can for other purposes. For example, when building that needs to return to the caller immediately but continue executing asynchronously (such as a long-lived image conversion), the web API can provide a status check URI that allows the original client who requested the conversion to check on the conversion’s status. This status check web API should return 303 See Other to the caller when the task is complete, along with a URI from which to retrieve the result in the HTTP field .
Example:POST / HTTP/1.1Host: www.google.co.inServer Response:HTTP/1.
1 303 See OtherLocation: http://www.google.co.in304 Not Modified:304 Status Code indicates the URL is Not modified and nothing changing in the URL since the last specific date.If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client.
Response headers are as if the client had sent a HEAD request, but limited to only those headers which make sense in this context. This means only headers that are relevant to cache managers and which may have changed independently of the document’s Last-Modified date. Examples include Date , Server and Expires .The purpose of this feature is to allow efficient updates of local cache information (including relevant meta information) without requiring the overhead of multiple HTTP requests (e.
g. a HEAD followed by a GET) and minimizing the transmittal of information already known by the requesting client (usually a caching proxy).305 Use Proxy:305 Code is used for request to a new URL Is accessed from a proxy and start the internet using another location into that place and work will be done into another use of internet.306 Unused:This code is no longer used in HTTP.307 Temporary Redirect:This Code is used for the requested page or site will be moved on temporary to the new URL in the browser.4xx Client Error:This class will give all the client error where the client request is not appropriate or cannot be fulfilled.400 Bad Request:The status code 400(Bas Request) indicate that the server did not understand the requested action from client.401 Unauthorised:The status code 401(Unauthorised) indicates that the requested page is credential protected and it needs a username and password.
402 Payment Required:The status code 402(Payment required) indicates that the requested page needs the payment first and then it will be displayed.403 Forbidden:The status code 403(Forbidden) indicates that the access of the page is forbidden.404 Not Found:The status code 404(Not found) indicates that server cannot found the requested page.
405 Method Not Allowed:The status code 405(Method Not allowed) indicates that the method specified in the request is not allowed.406 Not Acceptable:The status code 406(Not Acceptable) indicates that the server can only generate a response that is not accepted by the client.407 Proxy Authentication Required:The status code 407(Proxy Authentication required) indicates that you must authenticate with a proxy server before this request can be served.408 Request Timeout:The status code 408(Requested Timeout) indicate that the request took longer than the server was prepared to wait.409 Conflict:The status code 409(Conflict) indicates that the request could not be completed because of a conflict.410 Gone:This status code indicates the requested page is no longer available.
411 Length Required:This status code indicates that the “Content-Length” is not defined. The server will not accept the request without it.412 Precondition Failed:This status code indicates that pre-condition given in the request evaluated to false by the server.413 Request Entity Too Large:This status code indicates that the server will not accept the request, because the request entity is too large.
414 Request-URL Too Long:This status code indicates that the server will not accept the request, because the URL is too long. Occurs when you convert a “post” request to a “get” request with a long query information.415 Unsupported Media Type:This status code indicates that the server will not accept the request, because the media type is not supported.
416 Requested Range Not Satisfiable:This status code indicates that the requested byte range is not available and is out of bounds.417 Expectation Failed:His status code indicates that the expectation given in an Expect request header field could not be met by this server.5xx: Server ErrorIt means the server failed to fulfil an apparently valid request.500 Internal Server Error:This status code indicates that the request was not completed. The server met an unexpected condition.501 Not Implemented:This status code indicates that the request was not completed. The server did not support the functionality required.502 Bad Gateway:The status code indicates that the request was not completed.
The server received an invalid response from the upstream server.503 Service Unavailable:The status code indicates that the request was not completed. The server is temporarily overloading or down.
504 Gateway Timeout:This status code indicates that the gateway has timed out.505 HTTP Version Not Supported:This status code indicates that the server does not support the “http protocol” version.Message HandlingHttp messages contains how data & information are transferred between the HTTP client and Http server. Message Handlers are nothing but a chain of classes that sits next to the process of HTTP request and response through a pipeline.? HttpServer gets the request from the host.
? HttpRoutingDispatcher dispatches the request based on the route. ? HttpControllerDispatcher sends the request to a Web API controller.It contains two types of messages:1.request-type2.response-typeRequest-Type: request is sent by the client to trigger an action on the server.Response-type: response contains the answer sent by the server and client also accept them.Http Message Structures:http messages contains following fields:Astart-line:Start line contains request-line and status-line.Request-line is sent by the client and it is also used various methods like as a get,post etc.
for performing an action to the server.Status-line is sent by the server with specific response to the client.For example:BHeader-fieldHttp header specify the request,response or message body that are included in the message.Http header consists of four types that are describes below: 1.General-header: These header fields have general applicability for both request and response messages.Connection: The Connection general-header field allows the sender to specify options that are desired for that particular connection and must not be communicated by proxies over further connections.Date: All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception.
Pragma: The Pragma general-header field is used to include implementation specific directives that might apply to any recipient along the request/response chain.Trailer: The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding.Transfer-Encoding: The Transfer-Encoding general-header field indicates what type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient. This is not the same as content-encoding because transfer-encodings are a property of the message, not of the entity-body.Upgrade: The Upgrade general-header allows the client to specify what additional communication protocols it supports and would like to use if the server finds it appropriate to switch protocols.Warning: The Warning general-header is used to carry additional information about the status or transformation of a message which might not be reflected in the message.
2.request-header:It is applicable for any request messages:Accept: Media type(s) that is (/are) acceptable for the response. See Content negotiation.Accept-Charset: Character sets that are acceptable.Accept-Encoding: Supports list of acceptable encodings.Accept-Language: Supports list of acceptable human languages for response.
Authorization: Authentication credentials for HTTP Authentication.Content-Length: The length of the request body in octets (8-bit bytes).Content-Type: The Media type of the body of the request (used with POST and PUT requests).Expect: Indicates that particular server behaviours are required by the client.From: The email address of the user making the request.Host: The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening.
The port number may be omitted if the port is the standard port for the service requested.If-Match: Only perform the action if the client supplied entity matches the same entity on the server. This is mainly for methods like PUT to only update a resource if it has not been modified since the user last updated it.If-Range: If the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity.Origin: Initiates a request for cross-origin resource sharing (asks server for Access-Control-* response fields).
Proxy-Authorization:Authorization credentials for connecting to a proxy.Referrer: This is the address of the previous web page from which a link to the currently requested page was followed. (The word “referrer” has been misspelled in the RFC as well as in most implementations to the point that it has become standard usage and is considered correct terminology).3.response-header:It is applicable for response message.Accept-Patch: Specifies which patch document formats this server supports.
Accept-Ranges: What partial content range types this server supports via byte serving.Age: The age the object has been in a proxy cache in seconds.Proxy-Authenticate: Request authentication to access the proxy.Retry-After: If an entity is temporarily unavailable, this instructs the client to try again later. Value could be a specified period of time (in seconds) or a HTTP-date.Server: A name for the server.
Vary: Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server.WWW-Authenticate: Indicates the authentication scheme that should be used to access the requested entityETag: The ETag response-header field provides the current value of the entity tag for the requested variant.Location: The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion.4.Entity-header:It defines the metadata about the message-body or, if no body present, about the resource identified by the request.
Allow: Valid methods for a specified resource. To be used for a 405 Method not allowed.Content-Encoding: The type of encoding used on the data.Content-Language: The natural language or languages of the intended audience for the enclosed content.Content-Length: The length of the response body in octets (8-bit bytes).Content-Range: The Content-Range entity-header field is sent with a partial entity-body to specify where in the full entity-body the partial body should be applied.Content-Type: The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent, had the request been a GET.Expires: Gives the date/time after which the response is considered stale (in “HTTP-date” format as defined by RFC 7231).Last-Modified: The last modified date for the requested object (in “HTTP-date” format as defined by RFC 7231).C.message-body:Message body contains the language like as html, css, php, java script etc.For example: