diff options
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 0c21bc57..16477538 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2354,7 +2354,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2354 | (void) MHD_mutex_unlock_ (&response->mutex); | 2354 | (void) MHD_mutex_unlock_ (&response->mutex); |
2355 | if (ret < 0) | 2355 | if (ret < 0) |
2356 | { | 2356 | { |
2357 | if (MHD_SCKT_ERR_IS_EINTR_ (err) || MHD_SCKT_ERR_IS_EAGAIN_ (err)) | 2357 | if (MHD_SCKT_ERR_IS_EINTR_ (err) || |
2358 | MHD_SCKT_ERR_IS_EAGAIN_ (err)) | ||
2358 | return MHD_YES; | 2359 | return MHD_YES; |
2359 | #ifdef HAVE_MESSAGES | 2360 | #ifdef HAVE_MESSAGES |
2360 | MHD_DLOG (connection->daemon, | 2361 | MHD_DLOG (connection->daemon, |
@@ -2515,13 +2516,17 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2515 | } | 2516 | } |
2516 | break; | 2517 | break; |
2517 | } | 2518 | } |
2518 | if (MHD_NO == parse_initial_message_line (connection, line, line_len)) | 2519 | if (MHD_NO == parse_initial_message_line (connection, |
2519 | CONNECTION_CLOSE_ERROR (connection, NULL); | 2520 | line, |
2521 | line_len)) | ||
2522 | CONNECTION_CLOSE_ERROR (connection, | ||
2523 | NULL); | ||
2520 | else | 2524 | else |
2521 | connection->state = MHD_CONNECTION_URL_RECEIVED; | 2525 | connection->state = MHD_CONNECTION_URL_RECEIVED; |
2522 | continue; | 2526 | continue; |
2523 | case MHD_CONNECTION_URL_RECEIVED: | 2527 | case MHD_CONNECTION_URL_RECEIVED: |
2524 | line = get_next_header_line (connection, NULL); | 2528 | line = get_next_header_line (connection, |
2529 | NULL); | ||
2525 | if (NULL == line) | 2530 | if (NULL == line) |
2526 | { | 2531 | { |
2527 | if (MHD_CONNECTION_URL_RECEIVED != connection->state) | 2532 | if (MHD_CONNECTION_URL_RECEIVED != connection->state) |
@@ -2539,7 +2544,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2539 | connection->state = MHD_CONNECTION_HEADERS_RECEIVED; | 2544 | connection->state = MHD_CONNECTION_HEADERS_RECEIVED; |
2540 | continue; | 2545 | continue; |
2541 | } | 2546 | } |
2542 | if (MHD_NO == process_header_line (connection, line)) | 2547 | if (MHD_NO == process_header_line (connection, |
2548 | line)) | ||
2543 | { | 2549 | { |
2544 | transmit_error_response (connection, | 2550 | transmit_error_response (connection, |
2545 | MHD_HTTP_BAD_REQUEST, | 2551 | MHD_HTTP_BAD_REQUEST, |
@@ -2645,7 +2651,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2645 | } | 2651 | } |
2646 | break; | 2652 | break; |
2647 | case MHD_CONNECTION_BODY_RECEIVED: | 2653 | case MHD_CONNECTION_BODY_RECEIVED: |
2648 | line = get_next_header_line (connection, NULL); | 2654 | line = get_next_header_line (connection, |
2655 | NULL); | ||
2649 | if (NULL == line) | 2656 | if (NULL == line) |
2650 | { | 2657 | { |
2651 | if (connection->state != MHD_CONNECTION_BODY_RECEIVED) | 2658 | if (connection->state != MHD_CONNECTION_BODY_RECEIVED) |
@@ -2689,7 +2696,9 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2689 | break; | 2696 | break; |
2690 | } | 2697 | } |
2691 | if (MHD_NO == | 2698 | if (MHD_NO == |
2692 | process_broken_line (connection, line, MHD_FOOTER_KIND)) | 2699 | process_broken_line (connection, |
2700 | line, | ||
2701 | MHD_FOOTER_KIND)) | ||
2693 | continue; | 2702 | continue; |
2694 | if (0 == line[0]) | 2703 | if (0 == line[0]) |
2695 | { | 2704 | { |
@@ -3057,17 +3066,17 @@ MHD_get_connection_info (struct MHD_Connection *connection, | |||
3057 | { | 3066 | { |
3058 | #if HTTPS_SUPPORT | 3067 | #if HTTPS_SUPPORT |
3059 | case MHD_CONNECTION_INFO_CIPHER_ALGO: | 3068 | case MHD_CONNECTION_INFO_CIPHER_ALGO: |
3060 | if (connection->tls_session == NULL) | 3069 | if (NULL == connection->tls_session) |
3061 | return NULL; | 3070 | return NULL; |
3062 | connection->cipher = gnutls_cipher_get (connection->tls_session); | 3071 | connection->cipher = gnutls_cipher_get (connection->tls_session); |
3063 | return (const union MHD_ConnectionInfo *) &connection->cipher; | 3072 | return (const union MHD_ConnectionInfo *) &connection->cipher; |
3064 | case MHD_CONNECTION_INFO_PROTOCOL: | 3073 | case MHD_CONNECTION_INFO_PROTOCOL: |
3065 | if (connection->tls_session == NULL) | 3074 | if (NULL == connection->tls_session) |
3066 | return NULL; | 3075 | return NULL; |
3067 | connection->protocol = gnutls_protocol_get_version (connection->tls_session); | 3076 | connection->protocol = gnutls_protocol_get_version (connection->tls_session); |
3068 | return (const union MHD_ConnectionInfo *) &connection->protocol; | 3077 | return (const union MHD_ConnectionInfo *) &connection->protocol; |
3069 | case MHD_CONNECTION_INFO_GNUTLS_SESSION: | 3078 | case MHD_CONNECTION_INFO_GNUTLS_SESSION: |
3070 | if (connection->tls_session == NULL) | 3079 | if (NULL == connection->tls_session) |
3071 | return NULL; | 3080 | return NULL; |
3072 | return (const union MHD_ConnectionInfo *) &connection->tls_session; | 3081 | return (const union MHD_ConnectionInfo *) &connection->tls_session; |
3073 | #endif | 3082 | #endif |