[MINOR] http: don't wait for sending requests to the server
By default we automatically wait for enough data to fill large
packets if buf->to_forward is not null. This causes a problem
with POST/Expect requests which have a data size but no data
immediately available. Instead of causing noticeable delays on
such requests, simply add a flag to disable waiting when sending
requests.
diff --git a/src/stream_sock.c b/src/stream_sock.c
index 4a9434c..5caac46 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -623,7 +623,15 @@
send_flag |= MSG_MORE;
}
+ /* this flag has precedence over the rest */
+ if (b->flags & BF_SEND_DONTWAIT)
+ send_flag &= ~MSG_MORE;
+
ret = send(si->fd, b->w, max, send_flag);
+
+ /* disable it only once everything has been sent */
+ if (ret == max && (b->flags & BF_SEND_DONTWAIT))
+ b->flags &= ~BF_SEND_DONTWAIT;
} else {
int skerr;
socklen_t lskerr = sizeof(skerr);