Re: Authenticating large, dynamic posts

steve.kilbane@ind.alstom.com
Tue, 1 Jun 1999 17:33:58 +0100


I've been digging into this a bit more, with discouraging results. An attempted
workaround used $DYNAMIC_UPLOAD_AUTH, and an extra element to filehandle
elements of the @parts array for the closure produced by
HTTP::Protocol::Common.pm. The extra element was an integer, with the following
meanings:

- negative: return some dummy data ("dummy data");
- zero: return a zero-length string;
- positive: read a chunk from the file, and return it.

This was set to -1 or +1, depending on $DYNAMIC_UPLOAD_AUTH, and was incremented
each time the closure was called.  In other words, if $DYNAMIC_UPLOAD_AUTH was
set, then the closure would return dummy data for the first HTTP request, and
real data for the second one.

This worked, once,  but appears to be nailed by a race condition. I previously
wrote:

> the sysread() for fetching the
> response also failed ("Invalid argument") - I had at least expected any
incoming
> data to still be available.

Additionally, when the response is being read by the sub passed to
Protocol::collect(), the read() gets Invalid argument. The entire response
(about 700 bytes) is read when the response is first fetched. No further bytes
are pulled in by HTTP 1.1 header parsing, and the first call of the collector
uses the remaining 644 bytes from the buffer. Next call to read() dies. I can't
see anywhere where a read returns eof. Presumably, this is a bug somewhere, but
I don't know if it's in my 5.004_01 Perl, the Windows NT 4.0 TCP stack, or
IO::Handle. I suspect a big upgrade is needed. :-(

steve