On_sock_postdata

Top  Previous  Next

Function:

Generated when at least one data byte is present in the VAR buffer of the socket, but only after the VAR buffer has become full at least once in the cause of the current HTTP request processing.

Declaration:

on_sock_postdata

See Also:

Sock.varbuffrq, sock.varlen

 


Details

HTTP requests can contain large amount of HTTP variable data, which is stored into the VAR buffer. The amount of such data can exceed the VAR buffer capacity. If this is not handled properly, the HTTP request execution may stall indefinitely — see Working with HTTP Variables.

After the socket accepts an HTTP connection, this event is not generated (for this particular connection) until the VAR buffer becomes full. Once this happened, the event is generated even if there is a single byte waiting to be processed in the buffer. Two same-socket on_sock_postdata events never wait in the queue — the next event can only be generated after the previous one is processed.

When the event handler for this event is entered the sock.num property is automatically switched to the socket for which this event was generated.

Use the sock.gethttprqstring method or sock.httprqstring property to work with the VAR buffer's data.