- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
The GET Method in Font
The GET Method QR Encoder In None Using Barcode generation for Font Control to generate, create Quick Response Code image in Font applications. www.OnBarcode.comCode39 Creation In None Using Barcode maker for Font Control to generate, create USS Code 39 image in Font applications. www.OnBarcode.comWhen the earliest version of HTTP was first invented, it had a single power: to issue a method called GET that named and returned a hypertext document from a remote server. That method is still the backbone of the protocol today. Creating PDF417 In None Using Barcode creation for Font Control to generate, create PDF 417 image in Font applications. www.OnBarcode.comUPC Code Drawer In None Using Barcode printer for Font Control to generate, create UPC Symbol image in Font applications. www.OnBarcode.comCHAPTER 9 HTTP
Painting Barcode In None Using Barcode encoder for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comDataMatrix Generator In None Using Barcode generation for Font Control to generate, create Data Matrix ECC200 image in Font applications. www.OnBarcode.comFrom now on, I am going to make heavy use of ellipsis (three periods in a row: ...) to omit parts of each HTTP request and response not currently under discussion. That way, we can more easily focus on the protocol features being described. The GET method, like all HTTP methods, is the first thing transmitted as part of an HTTP request, and it is immediately followed by the request headers. For simple GET methods, the request simply ends with the blank line that terminates the headers so the server can immediately stop reading and send a response: >>> info = opener.open('http://www.ietf.org/rfc/rfc2616.txt') -------------------------------------------------GET /rfc/rfc2616.txt HTTP/1.1 ... Host: www.ietf.org ... -------------------- Response -------------------HTTP/1.1 200 OK ... Content-Type: text/plain The opener s open() method, like the plain urlopen() function at the top level of urllib2, returns an information object that lets us examine the result of the GET method. You can see that the HTTP request started with a status line containing the HTTP version, a status code, and a short message. The info object makes these available as object attributes; it also lets us examine the headers through a dictionary-like object: >>> info.code 200 >>> info.msg 'OK' >>> sorted(info.headers.keys()) ['accept-ranges', 'connection', 'content-length', 'content-type', 'date', 'etag', 'last-modified', 'server', 'vary'] >>> info.headers['Content-Type'] 'text/plain' Finally, the info object is also prepared to act as a file. The HTTP response status line, the headers, and the blank line that follows them have all been read from the HTTP socket, and now the actual document is waiting to be read. As is usually the case with file objects, you can either start reading the info object in pieces through read(N) or readline(); or you can choose to bring the entire data stream into memory as a single string: >>> print info.read().strip() Network Working Group Request for Comments: 2616 Obsoletes: 2068 Category: Standards Track ... R. Fielding UC Irvine J. Gettys Compaq/W3C Making USS Code 128 In None Using Barcode printer for Font Control to generate, create USS Code 128 image in Font applications. www.OnBarcode.comUSPS Confirm Service Barcode Drawer In None Using Barcode maker for Font Control to generate, create USPS Confirm Service Barcode image in Font applications. www.OnBarcode.comThese are the first lines of the longer text file that you will see if you point your web browser at the same URL. That, then, is the essential purpose of the GET method: to ask an HTTP server for a particular document, so that its contents can be downloaded and usually displayed on the local system. QR-Code Printer In Visual Basic .NET Using Barcode generator for .NET Control to generate, create QR Code image in Visual Studio .NET applications. www.OnBarcode.comQR-Code Printer In VS .NET Using Barcode creator for ASP.NET Control to generate, create QR Code 2d barcode image in ASP.NET applications. www.OnBarcode.comCHAPTER 9 HTTP
Encode Code 128 Code Set C In Objective-C Using Barcode printer for iPhone Control to generate, create Code 128 Code Set A image in iPhone applications. www.OnBarcode.com2D Drawer In Visual Studio .NET Using Barcode printer for ASP.NET Control to generate, create 2D Barcode image in ASP.NET applications. www.OnBarcode.comThe Host Header
Recognize UPC Symbol In None Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comQR Code Decoder In .NET Framework Using Barcode reader for VS .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comYou will have noted that the GET request line includes only the path portion of the full URL: GET /rfc/rfc2616.txt HTTP/1.1 The other elements have, so to speak, already been consumed. The http scheme determined what protocol would be spoken, and the location www.ietf.org was used as the hostname to which a TCP connection must be made. And in the early versions of HTTP, this was considered enough. After all, the server could tell you were speaking HTTP to it, and surely it also knew that it was the IETF web server if there were confusion on that point, it would presumably have been the job of the IETF system administrators to sort it out! But in a world of six billion people and four billion IP addresses, the need quickly became clear to support servers that might host dozens of web sites at the same IP. Systems administrators with, say, twenty different domains to host within a large organization were annoyed to have to set up twenty different machines or to give twenty separate IP addresses to one single machine simply to work around a limitation of the HTTP/1.0 protocol. And that is why the URL location is now included in every HTTP request. For compatibility, it has not been made part of the GET request line itself, but has instead been stuck into the headers under the name Host: >>> info = opener.open('http://www.google.com/') -------------------------------------------------GET / HTTP/1.1 ... Host: www.google.com ... -------------------- Response -------------------HTTP/1.1 200 OK ... Depending on how they are configured, servers might return entirely different sites when confronted with two different values for Host; they might present slightly different versions of the same site; or they might ignore the header altogether. But semantically, two requests with different values for Host are asking about two entirely different URLs. When several sites are hosted at a single IP address, those sites are each said to be served by a virtual host, and the whole practice is sometimes referred to as virtual hosting. Make EAN / UCC - 13 In Java Using Barcode maker for BIRT reports Control to generate, create UCC.EAN - 128 image in BIRT reports applications. www.OnBarcode.comCreate Barcode In Java Using Barcode encoder for Android Control to generate, create Barcode image in Android applications. www.OnBarcode.comScan Data Matrix ECC200 In .NET Framework Using Barcode recognizer for VS .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comGenerating PDF 417 In Java Using Barcode generator for Java Control to generate, create PDF-417 2d barcode image in Java applications. www.OnBarcode.comUSS Code 39 Generator In None Using Barcode encoder for Software Control to generate, create USS Code 39 image in Software applications. www.OnBarcode.comCreate DataMatrix In None Using Barcode encoder for Software Control to generate, create Data Matrix 2d barcode image in Software applications. www.OnBarcode.com |
|