Page 208 - Open Soource Technologies 304.indd
P. 208

Web Technologies-I



                   Notes         The body of the message is either the content being sent from the server to the client, or form
                                 data or an uploaded file being sent from the client to the server. In other words, it is the thing
                                 we think of as being the document we sent or received. Not much more needs to be said about
                                 that here. However, the other two sections can use some explanation.
                                                The Hypertext Transfer Protocol (HTTP) is a networking protocol for
                                                distributed,  collaborative,  hypermedia  information  systems;  HTTP  is  the
                                                foundation of data communication for the World Wide Web.


                                 9.1.1 Request and Response
                                 If the request line can be seen as a specification of what to order from whom, the response line
                                 can be seen as the receipt confirming that the transaction took place. There can only be one of
                                 the two in any message.
                                 The request contains three critical pieces of information. The first is the method of request, which
                                 is to say, how the server is supposed to process it. The second is the path to the resource being
                                 requested. The third is the version number of HTTP being used.

                                 The method tells the server how to handle the request. The three most common are GET, HEAD,
                                 and POST.
                                 GET
                                 This is a simple request for a document or resource residing at a specific URI (Uniform Resource
                                 Indicator). It is the most common type of Web request.
                                 HEAD
                                 This is similar to a GET request, except that it is only looking for HTTP header information on
                                 the resource, not the resource itself.
                                 POST
                                 Indicates that information is being sent the server inside the HTTP body. The URI should point
                                 to a resource capable of handling the data being posted.
                                 A typical request header might look something like this:
                                 GET /index.php HTTP/1.1
                                 The reply line indicates whether the request was successful. It includes the protocol being used,
                                 a numeric status code, and a short description of the status code.
                                 HTTP/1.1 200 OK
                                 The numeric status codes fall into the following ranges:
                                 100-199
                                 Information messages on the current status of processing.
                                 200-299
                                 Successful request.

                                 300-399
                                 Request cancelled because document or resource has been moved.
                                 400-499
                                 Client error. The request was incomplete, incorrect, or otherwise unresolvable.
                                 500-599
                                 Server error. Request appears valid, but server could not complete it.



        202                               LOVELY PROFESSIONAL UNIVERSITY
   203   204   205   206   207   208   209   210   211   212   213