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. The effect is that a large request fails to transmit all the request body, and then it deadlocks, waiting for the response which doesn't arrive. Or, if the server responds with an error without reading all the request, the client will successfully read the error but will block waiting for the shutdown() from the server, as the server must still try to read the rest of the request. (The client should abort sending after receiving the error, though). -- Jamie