Jamie Lokier <[EMAIL PROTECTED]> writes: > Gisle Aas wrote: > > > The subroutine Net::HTTP::Methods::write_request calls print, but > > > doesn't check the return value. > > > > > > It's a non-blocking socket, so it's quite normal for the print to do a > > > "short write" if the string is very large -- larger than the socket > > > transmit buffer. > > > > I would belive that print should be responsible for the handing short > > writes itself. On what system are you running and what perl version > > are you using? > > Red Hat 9, perl-5.8.0-88.3. > > print normally does handly short writes and keep writing until it's > done the whole string. However, it will stop when it gets an error > code, and it does: EAGAIN because the socket transmit buffer is full > and it's non-blocking.
Yes. That's a problem, but it might be argued that the user of $http->write_request() is responsible for checking for the error. The method will return FALSE on error and set $! like print :) > > What could make sense to to rewrite Net::HTTP so that it use syswrite > > all over the place instead. With it we can easily handle short writes > > outself. > > It's not the short writes as such, it's the EAGAINs. This problem is exactly why LWP::Protocol::http never use write_request() itself, but calls format_request() and then use syswrite() to get the bytes out on the wire. Regards, Gisle