.httprqstring R/O Property
Function: |
For the selected socket (selection is made through sock.num), returns up to 255 bytes of the HTTP request string stored in the VAR buffer. |
Type: |
String |
Value Range: |
Default = "" |
See Also: |
Details
The sock.httprqstring property can be invoked several times and will return the same data (when this property is used, the data is not deleted from the VAR buffer). The VAR buffer's contents are explained in Details on Variable Data.
This property is only relevant when the socket is in the HTTP mode (sock.httpmode = 1 — YES). Use it from within an HTML page or the on_sock_postdata event handler. The maximum length of data that can be obtained through this property is 255 bytes, since this is the maximum possible capacity of a string variable that will accept the value of the sock.httprqstring.
HTTP requests can be much longer than 255 bytes and can even include entire files being uploaded from the client to your device. Rely on the on_sock_postdata event and the sock.gethttprqstring method to handle large amounts of HTTP variable data correctly.
If you are using sock.httprqstring and the client sends more data than can fit in the VAR buffer, the execution of the HTTP request will be stalled indefinitely. To avoid this, reply on the on_sock_postdata event and the sock.gethttprqstring method, as explained in Complex Case (Large Amount of Variable Data).