aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/connection.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-07-19 20:39:19 +0000
committerng0 <ng0@n0.is>2019-07-19 20:39:19 +0000
commitb854bbba20255f77a681a4020191dc8b42e23049 (patch)
tree8a6107b0b59e5dd6b5badacc528f1dae3abd18bb /src/microhttpd/connection.c
parent23a7502ef4edca9546a00ac3b9f88e126414aeb0 (diff)
downloadlibmicrohttpd-b854bbba20255f77a681a4020191dc8b42e23049.tar.gz
libmicrohttpd-b854bbba20255f77a681a4020191dc8b42e23049.zip
replace connection->send_cls()
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r--src/microhttpd/connection.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 877f514b..4d93acee 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -53,7 +53,7 @@
53/* For FreeBSD version identification */ 53/* For FreeBSD version identification */
54#include <sys/param.h> 54#include <sys/param.h>
55#endif /* HAVE_SYS_PARAM_H */ 55#endif /* HAVE_SYS_PARAM_H */
56 56#include "mhd_send.h"
57 57
58/** 58/**
59 * Message to transmit when http 1.1 request is received 59 * Message to transmit when http 1.1 request is received
@@ -3303,11 +3303,12 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
3303 case MHD_CONNECTION_HEADERS_PROCESSED: 3303 case MHD_CONNECTION_HEADERS_PROCESSED:
3304 return; 3304 return;
3305 case MHD_CONNECTION_CONTINUE_SENDING: 3305 case MHD_CONNECTION_CONTINUE_SENDING:
3306 ret = connection->send_cls (connection, 3306 ret = MHD_send_on_connection_ (connection,
3307 &HTTP_100_CONTINUE 3307 &HTTP_100_CONTINUE
3308 [connection->continue_message_write_offset], 3308 [connection->continue_message_write_offset],
3309 MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE) - 3309 MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE) -
3310 connection->continue_message_write_offset); 3310 connection->continue_message_write_offset,
3311 MHD_SSO_NO_CORK);
3311 if (ret < 0) 3312 if (ret < 0)
3312 { 3313 {
3313 if (MHD_ERR_AGAIN_ == ret) 3314 if (MHD_ERR_AGAIN_ == ret)
@@ -3337,11 +3338,13 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
3337 mhd_assert (0); 3338 mhd_assert (0);
3338 return; 3339 return;
3339 case MHD_CONNECTION_HEADERS_SENDING: 3340 case MHD_CONNECTION_HEADERS_SENDING:
3340 ret = connection->send_cls (connection, 3341 /* TODO: Maybe use MHD_send_on_connection2_()? */
3341 &connection->write_buffer 3342 ret = MHD_send_on_connection_ (connection,
3342 [connection->write_buffer_send_offset], 3343 &connection->write_buffer
3343 connection->write_buffer_append_offset - 3344 [connection->write_buffer_send_offset],
3344 connection->write_buffer_send_offset); 3345 connection->write_buffer_append_offset -
3346 connection->write_buffer_send_offset,
3347 MHD_SSO_MAY_CORK);
3345 if (ret < 0) 3348 if (ret < 0)
3346 { 3349 {
3347 if (MHD_ERR_AGAIN_ == ret) 3350 if (MHD_ERR_AGAIN_ == ret)
@@ -3389,11 +3392,12 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
3389 - response->data_start; 3392 - response->data_start;
3390 if (data_write_offset > (uint64_t)SIZE_MAX) 3393 if (data_write_offset > (uint64_t)SIZE_MAX)
3391 MHD_PANIC (_("Data offset exceeds limit")); 3394 MHD_PANIC (_("Data offset exceeds limit"));
3392 ret = connection->send_cls (connection, 3395 ret = MHD_send_on_connection_ (connection,
3393 &response->data 3396 &response->data
3394 [(size_t)data_write_offset], 3397 [(size_t)data_write_offset],
3395 response->data_size - 3398 response->data_size -
3396 (size_t)data_write_offset); 3399 (size_t)data_write_offset,
3400 MHD_SSO_NO_CORK);
3397#if DEBUG_SEND_DATA 3401#if DEBUG_SEND_DATA
3398 if (ret > 0) 3402 if (ret > 0)
3399 fprintf (stderr, 3403 fprintf (stderr,
@@ -3432,11 +3436,12 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
3432 mhd_assert (0); 3436 mhd_assert (0);
3433 return; 3437 return;
3434 case MHD_CONNECTION_CHUNKED_BODY_READY: 3438 case MHD_CONNECTION_CHUNKED_BODY_READY:
3435 ret = connection->send_cls (connection, 3439 ret = MHD_send_on_connection_ (connection,
3436 &connection->write_buffer 3440 &connection->write_buffer
3437 [connection->write_buffer_send_offset], 3441 [connection->write_buffer_send_offset],
3438 connection->write_buffer_append_offset - 3442 connection->write_buffer_append_offset -
3439 connection->write_buffer_send_offset); 3443 connection->write_buffer_send_offset,
3444 MHD_SSO_NO_CORK);
3440 if (ret < 0) 3445 if (ret < 0)
3441 { 3446 {
3442 if (MHD_ERR_AGAIN_ == ret) 3447 if (MHD_ERR_AGAIN_ == ret)
@@ -3460,11 +3465,12 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
3460 mhd_assert (0); 3465 mhd_assert (0);
3461 return; 3466 return;
3462 case MHD_CONNECTION_FOOTERS_SENDING: 3467 case MHD_CONNECTION_FOOTERS_SENDING:
3463 ret = connection->send_cls (connection, 3468 ret = MHD_send_on_connection_ (connection,
3464 &connection->write_buffer 3469 &connection->write_buffer
3465 [connection->write_buffer_send_offset], 3470 [connection->write_buffer_send_offset],
3466 connection->write_buffer_append_offset - 3471 connection->write_buffer_append_offset -
3467 connection->write_buffer_send_offset); 3472 connection->write_buffer_send_offset,
3473 MHD_SSO_HDR_CORK);
3468 if (ret < 0) 3474 if (ret < 0)
3469 { 3475 {
3470 if (MHD_ERR_AGAIN_ == ret) 3476 if (MHD_ERR_AGAIN_ == ret)