aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-17 13:57:22 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-17 13:57:22 +0300
commit3a02f18ca6a66997614cebf1231c86ad33148ad2 (patch)
tree76d293b8a11290a35fa040ce0d5af9f2da8f12c3
parent21cdab14f8c314dc44a90e3207fba7f4fc3f838c (diff)
downloadlibmicrohttpd-3a02f18ca6a66997614cebf1231c86ad33148ad2.tar.gz
libmicrohttpd-3a02f18ca6a66997614cebf1231c86ad33148ad2.zip
Simplified connection.c code: reused error reply function
-rw-r--r--src/microhttpd/connection.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 62e21d03..f973c93e 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3467,32 +3467,11 @@ parse_connection_headers (struct MHD_Connection *connection)
3467 connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; 3467 connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
3468#ifdef HAVE_MESSAGES 3468#ifdef HAVE_MESSAGES
3469 MHD_DLOG (connection->daemon, 3469 MHD_DLOG (connection->daemon,
3470 _ ("Received HTTP 1.1 request without `Host' header.\n")); 3470 _ ("Received HTTP/1.1 request without `Host' header.\n"));
3471#endif 3471#endif
3472 mhd_assert (NULL == connection->response); 3472 transmit_error_response_static (connection,
3473 response = 3473 MHD_HTTP_BAD_REQUEST,
3474 MHD_create_response_from_buffer (MHD_STATICSTR_LEN_ (REQUEST_LACKS_HOST), 3474 REQUEST_LACKS_HOST);
3475 REQUEST_LACKS_HOST,
3476 MHD_RESPMEM_PERSISTENT);
3477 if (NULL == response)
3478 {
3479 /* can't even send a reply, at least close the connection */
3480 CONNECTION_CLOSE_ERROR (connection,
3481 _ (
3482 "Closing connection (failed to create response)."));
3483 return;
3484 }
3485 iret = MHD_queue_response (connection,
3486 MHD_HTTP_BAD_REQUEST,
3487 response);
3488 MHD_destroy_response (response);
3489 if (MHD_NO == iret)
3490 {
3491 /* can't even send a reply, at least close the connection */
3492 CONNECTION_CLOSE_ERROR (connection,
3493 _ (
3494 "Closing connection (failed to queue response)."));
3495 }
3496 return; 3475 return;
3497 } 3476 }
3498 3477