[ Pobierz całość w formacie PDF ]
.exe HTTP/1.0Referer: http://pc229.west.ora.com/hello.htmConnection: Keep-AliveUser-Agent: Mozilla/3.0 (Win95; I)Host: pc229.west.ora.comAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*[70:send:(69)]Content-type: application/x-www-form-urlencodedContent-length: 14[70:send:(2)][70:send:(16)]name=Jayne+DoeBecause the browser is transmitting form data, the HTTP request type is POST, as the very first header record indicates.Similarly, the Content-lengthand Content-type records indicate that the browser is transmitting 14 bytes ofx-www-form-urlencoded data in the body of the request.This consists ofthe information input by the user in the form s single data field, the name textbox.6.The server receives the header records and form data transmitted by thebrowser in the previous step.(Since it s basically identical to the text sent byHow HTTP Works 51ASP in a Nutshell: A Desktop Quick Reference, eMatter EditionCopyright © 2000 O Reilly & Associates, Inc.All rights reserved. How HTTP Worksthe browser, we won t duplicate it here.) The URL (/cgi-win/hello.exe) causesthe server to launch the CGI application HELLO.EXE and to transmit theform s data to it.The CGI application may do some back-end processing, thenbuilds an HTML document on the fly and returns it to the server.7.The server returns the HTML document to the browser along with the neces-sary header records, as the following output from WSock32 Spy shows:[18:send:(422)]HTTP/1.0 200 OKDate: Monday, 30-Sep-98 23:33:10 GMTServer: WebSite/1.1Allow-ranges: bytesAccept-ranges: bytesConnection: Keep-AliveContent-type: text/htmlContent-length: 231Welcome to this Web Page!Welcome to Our Web Server!Hello, Jayne Doe! We're glad that you tookthe time out of your busy day to visit us!Notice that the server indicates to the browser that it s sending 231 bytes of anHTML document.8.The browser receives the data stream send by the server and uses it to renderthe HTML page.Hopefully, this gives you a fairly good sense of what s involved in the interchangebetween browser and server.It s important, though, to take a more in-depth lookat some of the points that we ve touched on only briefly, as well as to cover someadditional features that are not included in this simple example.HTTP Request TypesThe request type is passed by the client to the server to indicate what the servershould do with the URL that s also supplied by the browser.Although the HTTPspecification details a number of request types, like PUTand DELETE, only two aresupported by all servers and in common use: GET and POST.A GET request asksthe server to  get a piece of information, typically a document, and return it tothe client.If the request includes any additional information, these are appendedas arguments to the URL.A POST request, on the other hand, provides the serverwith information to be  posted to the URL; typically, it s used to send the contentsof an HTML form to the server, or to provide the server with information that sneeded for back-end processing.The information itself is contained in the body ofthe request.Most servers cannot handle data received from either the POST or GET methodsinternally.Normally, POST requests, as well as GET requests that also send data tothe server, are handled by accessory programs or DLLs (CGI and ISAPI applica-52 Chapter 6  Request ObjectASP in a Nutshell: A Desktop Quick Reference, eMatter EditionCopyright © 2000 O Reilly & Associates, Inc.All rights reserved. How HTTP Workstions and ISAPI filters).Both POSTand GETrequests can return any kind of data ofany size.While it may seem when transmitting data to a web server that GET and POST aresimilar, one rule is hard and fast: A GET request must never change anything.Don t write an ASP script that makes changes to a database, for instance, inresponse to a GET request.The reason for this is discussed in greater detail in thefollowing section,  Form Submission [ Pobierz caÅ‚ość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • odbijak.htw.pl