in reply to simulating LWP's "results" with pure sockets
This shuts down the writing side of the socket, dropping it into half-duplex mode, while leaving the read side open. The server catches an EOF on its end and is able to write back the status response. Pretty much classic HTTP.shutdown SOCK, 1; my $data = (<SOCK>); print "result->$data\n";
The other way to do this (assuming a proper HTTP server) is to write the length of the file in the Content-Length header. The server can then know to stop reading once it gets that many bytes. However, your CGI doesn't use Content-Length to determin when it's done reading so...
c.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: simulating LWP's "results" with pure sockets
by zentara (Cardinal) on Mar 08, 2005 at 23:28 UTC |