Site Loader
Rock Street, San Francisco

HTTP stands for Hyper Text Transfer protocol. Development of HTTP was initiated by Tim Berners-Lee. It is application layer protocol which provide the communication between HTTP client and HTTP server. HTTP protocol mainly used to access data on World Wide Web (WWW).HTTP protocol use the services of TCP on port 80. HTTP is a protocol to exchange or transfer of Hypertext. HTTP function is a combination of FTP (File Transfer Protocol) and SMTP (Simple Mail Transfer Protocol). Basically, HTTP is TCP/IP based communication protocol that is used to exchange the data on World Wide Web. This is foundation of data communication for World Wide Web. Standards development of HTTP was coordinated by Internet Engineering Task Force (IETF). First version of HTTP was developed in 1991 which is HTTP/0.9. Main function of HTTP is to transmit data across the internet.VERSIONYearHTTP Version19910.919961.019971.120152.0Working of HTTP:? An “HTTP client” is a program that establish a connection and send a request to “HTTP server”.Communication between HTTP client and HTTP Server? An “HTTP server” is also one type of program that accept a request and send response to “HTTP Client”.FEATURES OF HTTP PROTOCOL:There are some basic feature are describe here.? Connectionless: The HTTP client initiates an HTTP request, after a request is made it gets disconnected from the server and waits for a response. The server gives the response to the request received and re-establishes the connection with the client to send a response back.? Independent: Any type of data can be sent by HTTP but both the client and the server should know how to handle the data content. It is required by both to specify the content type using appropriate MIME-type.? Stateless: As HTTP is connectionless it can directly considered as a stateless protocol. The server and client are aware of each other only while they are doing transaction with each other. After that, both of them has no knowledge about each other. Due to this, both client and the server cannot gain information of each other during different requests across the web pages.HTTP Aspects:MethodsStatus codeRequest/Response LineMessage HandlerHTTP Architecture:The HTTP protocol is based on a request/response model. The communication generally takes place over a TCP/IP connection on the Internet. The default port is 80, but other ports can be used.A requesting program (a client) establishes a connection with a receiving program (a server) and sends a request to the server in the form of a request method, URI, and protocol version, followed by a message containing request modifiers, client information, and possible body content. The server responds with a status line, including its protocol version and a success or error code, followed by a message containing server information, entity met information, and possible body content.Methods:There are mainly two basic methods of HTTP protocol.1. GET2. POST3. HEAD4. PUT5. DELETE6. CONNECT7. OPTION8. TRACEA. GET? In GET method only limited amount of data can be sent, because data is sent in header .GET method is not secure in compare to POST method because data exposed in URL bar. GET method is more efficient and more used than POST method. GET method can be bookmarked. GET method is idempotent. That means second request will be ignored until the response of first request will be delivered. GET method send up to 1024 character only. GET method can’t be send binary data, audio, video or any type of image file.? GET method is basically used for retrieving the information or data from the server using URL.Anatomy of GET Method:Name1=value1=value2=value3In GET method, name and value pairs are joined with equal sign and another pair of name and value are joined with ampersand.Example:B. POST:? In POST method large amount of data can be sent because data can be sent in body part. POST method is more secure than GET method because data can’t be exposed in URL. POST method is less efficient and less used than GET method. POST method can’t be bookmarked. POST method is non-idempotent. In POST method there is no limit of data size to be sent. In POST method we can sent Binary and ASCII data. POST method basically used to send data or information on the server.Example:C. HEADThis method is almost similar to GET method but it does not return the requested data. It is used to transfer header section, status line, server response code etc.HEAD is often used to check the following information:? Last-modified date of a document on the server for caching purpose.? Size of a document before downloading.? Server type? Type of requested DocumentExample:D. PUT:The PUT method is used to request the server to store the included entity-body at a location specified by the given URL. PUT method replace all the current representation of the target resource with the uploaded content.E. DELETE:The DELETE method is used to request the server to delete a file at a location specified by the given URL.DELETE method delete the addressed member of the collection.F. CONNECTThe CONNECT method is used by the client to establish a network connection to a web server over HTTP.G. OPTION:The OPTIONS method is used by the client to find out the HTTP methods and other options supported by a web server. The client can specify a URL for the OPTIONS method, or an asterisk (*) to refer to the entire server.H. TRACE:The TRACE method is used to echo the contents of an HTTP Request back to the requester which can be used for debugging purpose at the time of development.HTTP REQUEST/RESPONSE LINE:A. Request Structure of the Client:Message Structure:

Start line:1. Request Method2. Request URI3. HTTP versionRequest Method:1 .GET: GET method is used for retrieving the info. or data from the server using URL.2. POST: POST method is used to send data or Information to the server.3. HEAD: Transfer status line and header section.4) CONNECT: Connection establish between client and server.Example:GET/index.html HTTP/1.1Host: www.gmail.comRequest URI:URI stands for uniform resource identifier. It is used to identify name and resources on the internet.URI consist 2 parts:1. Before the colon( : ) denotes schema(protocol).2. And the part after colon depend upon the schema.Example:http://www.onlinesbi.comHTTP version:HTTP version define the version of http.Example:HTTP/0.9Request Header Filed: The request-header fields allow the client to pass additional information about the request, and about the client itself, to the server. These fields act as request modifiers.There are of some important Request-header fields:? Accept-Charset? Accept-Encoding? Accept-Language? Authorization? Expect? From? Host? If-Match? If-Modified-Since? If-None-Match? If-Range? If-Unmodified-Since? Max-Forwards? Proxy-Authorization? Range? Referrer? TE? User-AgentExample of Request Message:GET /hello.htm HTTP/1.1User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)Host: www.example.comAccept-Language: en-usAccept-Encoding: gzip, deflateConnection: Keep-AliveB. HTTP Response Structure from the Web Server:Message Structure:

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:

Post Author: admin

x

Hi!
I'm Lena!

Would you like to get a custom essay? How about receiving a customized one?

Check it out