Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Write request + headers + payload body in single socket.write #233
In POST requests, for example, the current code performs two writes:
In the case that the request + request headers + body could fit within a single packet, it would be preferable to buffer these requests and put them on the network using a single socket.write call. The current write-write-read pattern can have a negative impact if it triggers a certain aspect of Nagle's algorithm: http://en.wikipedia.org/wiki/Nagle's_algorithm
The various chunking and encoding options that exist for writing the body payload might make this difficult to do in any case but the general body==String case.