Details on Variable Data

So far we haven't touched on the subject of actual data that you will read using sock.httprqstring and sock.gethttprqstring. In other words, we haven't discussed the contents of the VAR buffer. It is time to clear this.

We have already explained that the above R/O property and method will return the same data, with the only difference that the sock.httprqstring will not actually remove the data from the VAR buffer and will not be able to access past the first 255 bytes of such data.

Data format in the VAR buffer depends on the method used.

VAR buffer contents — HTTP GET method

Supposing the client has sent the following request:

GET /form_get.html? user=CHUCKY&pwd=THEEVILDOLL HTTP/1.1


User-Agent: Mozilla/5.0 (and so on)

The VAR buffer will get everything past the URL and until the first CR/LF. The part is highlighted in blue. There are two variables — user and pwd. They are equal to "CHUCKY" and "THEEVILDOLL". Your application can just ignore the "HTTP/1.1" part.

VAR buffer contents — HTTP POST method

Here is a sample client request:

POST /form_get.html HTTP/1.1


User-Agent: Mozilla/5.0

(lots of stuff skipped)

Content-Type: multipart/form-data; boundary=---------------------------21724139663430

Content-Length: 257


Content-Disposition: form-data; name="user"



Content-Disposition: form-data; name="pwd"



You will get everything shown in blue.