views:

80

answers:

2

I found the quoted text in Programming Python 3rd edition by Mark Lutz from Chapter 16: Server-Side Scripting (page 987):

Forms also include a method option to specify the encoding style to be used to send data over a socket to the target server machine. Here, we use the post style, which contacts the server and then ships it a stream of user input data in a separate transmission. An alternative get style ships input information to the server in a single transmission step, by adding user inputs to the end of the URL used to invoke the script, usually after a ? character (more on this soon).

I read this with some puzzlement. As far as I know post data is sent in the same transmission as a part of the same http header. I have never heard of this extra step for post data transmission.

I quickly looked over the relevant HTTP rfc's and didn't notice any distinction in version 1.0 or 1.1. I also used wireshark for some analysis and didn't notice multiple transmissions for post.

Am I missing something fundamental or is this an error in the text?

+1  A: 

Simple POST request is in single step. but when you are uploading a file, than the form is posted in multiple parts. In that case, the content type application/x-www-form-urlencoded is changed to multipart/form-data.

Adeel
A: 

Yes, there is only one transmission of data between server and client.

The context of the passage was referring to communication between web server and cgi application. Server communication between the web server and the cgi application using POST happens in two separate transfers. The request for the python script is sent by the server in a single transfer and then the POST data is sent separately over stdin (two transfers).

Whereas with GET the input data is passed as env vars or command line args in one transfer.

tdedecko