diff options
Diffstat (limited to 'ot_http.c')
| -rw-r--r-- | ot_http.c | 7 |
1 files changed, 7 insertions, 0 deletions
| @@ -6,6 +6,7 @@ | |||
| 6 | /* System */ | 6 | /* System */ |
| 7 | #define _GNU_SOURCE | 7 | #define _GNU_SOURCE |
| 8 | #include <arpa/inet.h> | 8 | #include <arpa/inet.h> |
| 9 | #include <errno.h> | ||
| 9 | #include <pthread.h> | 10 | #include <pthread.h> |
| 10 | #include <stdio.h> | 11 | #include <stdio.h> |
| 11 | #include <stdlib.h> | 12 | #include <stdlib.h> |
| @@ -85,6 +86,12 @@ static void http_senddata(const int64_t sock, struct ot_workstruct *ws) { | |||
| 85 | buf_reset(&cookie->request); | 86 | buf_reset(&cookie->request); |
| 86 | 87 | ||
| 87 | written_size = write(sock, ws->reply, ws->reply_size); | 88 | written_size = write(sock, ws->reply, ws->reply_size); |
| 89 | /* A send buffer with no room in it is not a failure: nothing went out, so | ||
| 90 | the whole reply goes into the batch below and leaves when the socket | ||
| 91 | drains. Only a real error ends the connection here. */ | ||
| 92 | if (written_size < 0 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) | ||
| 93 | written_size = 0; | ||
| 94 | |||
| 88 | if ((written_size < 0) || ((written_size == ws->reply_size) && !ws->keep_alive)) { | 95 | if ((written_size < 0) || ((written_size == ws->reply_size) && !ws->keep_alive)) { |
| 89 | http_close(sock); | 96 | http_close(sock); |
| 90 | return; | 97 | return; |
