324
Platforms
©2000-2008 Tibbo Technology Inc.
Let's take a bit about why the socket may get stuck. The following diagram details
the flow of HTTP request and response processing:
As you can see from the diagram, the socket will automatically extract the variable
data and store it into the VAR buffer. The code example above will access the
buffer during the reply phase -- from within the "login.html" page. Problem is,
processing may never get that far. If the VAR buffer becomes full in the request
processing phase, the socket will simply keep waiting, and the reply phase will
never start! This is true no matter what HTTP method you use -- GET or POST.
and we will tell you how to avoid this.
To avoid a problem situation described in the
topic use a more
complex, but very reliable way of handling large HTTP variable data.
event is generated when there is data in the VAR buffer.
In this regard, the event is similar in nature to the
event
which is generated when the RX buffer of the socket has data. Unlike the
on_sock_data_arrival event, the on_sock_postdata will first be generated only
after the VAR buffer becomes full. That is, you won't be bothered by this event
unless the HTTP request processing simply can't continue without it.
OK, so now you have a chance to access and process the HTTP variable data as it
arrives and before the reply phase even starts. The
method, unlike the
R/O property, actually removes the data
from the VAR buffer, thus freeing up the buffer space. Diagram below illustrates
the process:
324
323
344
342
333
336