aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/connection.c')
-rw-r--r--src/daemon/connection.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index 2102017d..8217932e 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -153,7 +153,7 @@ MHD_queue_response (struct MHD_Connection *connection,
153 if ((connection == NULL) || 153 if ((connection == NULL) ||
154 (response == NULL) || 154 (response == NULL) ||
155 (connection->response != NULL) || 155 (connection->response != NULL) ||
156 (connection->bodyReceived == 0) || (connection->headersReceived == 0)) 156 (connection->bodyReceived == MHD_NO) || (connection->headersReceived == MHD_NO))
157 return MHD_NO; 157 return MHD_NO;
158 MHD_increment_response_rc (response); 158 MHD_increment_response_rc (response);
159 connection->response = response; 159 connection->response = response;
@@ -180,7 +180,7 @@ MHD_need_100_continue (struct MHD_Connection *connection)
180 return ((connection->version != NULL) && 180 return ((connection->version != NULL) &&
181 (0 == strcasecmp (connection->version, 181 (0 == strcasecmp (connection->version,
182 MHD_HTTP_VERSION_1_1)) && 182 MHD_HTTP_VERSION_1_1)) &&
183 (connection->headersReceived == 1) && 183 (connection->headersReceived == MHD_YES) &&
184 (NULL != (expect = MHD_lookup_connection_value (connection, 184 (NULL != (expect = MHD_lookup_connection_value (connection,
185 MHD_HEADER_KIND, 185 MHD_HEADER_KIND,
186 MHD_HTTP_HEADER_EXPECT))) 186 MHD_HTTP_HEADER_EXPECT)))
@@ -279,7 +279,7 @@ MHD_connection_get_fdset (struct MHD_Connection *connection,
279 if (fd == -1) 279 if (fd == -1)
280 return MHD_YES; 280 return MHD_YES;
281 if ((connection->read_close == MHD_NO) && 281 if ((connection->read_close == MHD_NO) &&
282 ((connection->headersReceived == 0) || 282 ((connection->headersReceived == MHD_NO) ||
283 (connection->readLoc < connection->read_buffer_size))) 283 (connection->readLoc < connection->read_buffer_size)))
284 { 284 {
285 FD_SET (fd, read_fd_set); 285 FD_SET (fd, read_fd_set);
@@ -289,7 +289,7 @@ MHD_connection_get_fdset (struct MHD_Connection *connection,
289 else 289 else
290 { 290 {
291 if ((connection->read_close == MHD_NO) && 291 if ((connection->read_close == MHD_NO) &&
292 ((connection->headersReceived == 1) && 292 ((connection->headersReceived == MHD_YES) &&
293 (connection->readLoc == connection->read_buffer_size))) 293 (connection->readLoc == connection->read_buffer_size)))
294 { 294 {
295 /* try growing the read buffer, just in case */ 295 /* try growing the read buffer, just in case */
@@ -591,8 +591,8 @@ parse_initial_message_line (struct MHD_Connection *connection, char *line)
591 * 591 *
592 * Once the header is complete, it should have set the 592 * Once the header is complete, it should have set the
593 * headers_received, url and method values and set 593 * headers_received, url and method values and set
594 * headersReceived to 1. If no body is expected, it should 594 * headersReceived to MHD_YES. If no body is expected, it should
595 * also set "bodyReceived" to 1. Otherwise, it should 595 * also set "bodyReceived" to MHD_YES. Otherwise, it should
596 * set "uploadSize" to the expected size of the body. If the 596 * set "uploadSize" to the expected size of the body. If the
597 * size of the body is unknown, it should be set to -1. 597 * size of the body is unknown, it should be set to -1.
598 */ 598 */
@@ -608,7 +608,7 @@ MHD_parse_connection_headers (struct MHD_Connection *connection)
608 unsigned long long cval; 608 unsigned long long cval;
609 struct MHD_Response *response; 609 struct MHD_Response *response;
610 610
611 if (connection->bodyReceived == 1) 611 if (connection->bodyReceived == MHD_YES)
612 abort (); 612 abort ();
613 colon = NULL; /* make gcc happy */ 613 colon = NULL; /* make gcc happy */
614 last = NULL; 614 last = NULL;
@@ -673,7 +673,7 @@ MHD_parse_connection_headers (struct MHD_Connection *connection)
673 goto DIE; 673 goto DIE;
674 } 674 }
675 connection->uploadSize = cval; 675 connection->uploadSize = cval;
676 connection->bodyReceived = cval == 0 ? 1 : 0; 676 connection->bodyReceived = cval == 0 ? MHD_YES : MHD_NO;
677 } 677 }
678 else 678 else
679 { 679 {
@@ -683,12 +683,12 @@ MHD_parse_connection_headers (struct MHD_Connection *connection)
683 { 683 {
684 /* this request does not have a body */ 684 /* this request does not have a body */
685 connection->uploadSize = 0; 685 connection->uploadSize = 0;
686 connection->bodyReceived = 1; 686 connection->bodyReceived = MHD_YES;
687 } 687 }
688 else 688 else
689 { 689 {
690 connection->uploadSize = -1; /* unknown size */ 690 connection->uploadSize = -1; /* unknown size */
691 connection->bodyReceived = 0; 691 connection->bodyReceived = MHD_NO;
692 } 692 }
693 } 693 }
694 end = MHD_lookup_connection_value (connection, 694 end = MHD_lookup_connection_value (connection,
@@ -796,7 +796,7 @@ MHD_call_connection_handler (struct MHD_Connection *connection)
796 796
797 if (connection->response != NULL) 797 if (connection->response != NULL)
798 return; /* already queued a response */ 798 return; /* already queued a response */
799 if (connection->headersReceived == 0) 799 if (connection->headersReceived == MHD_NO)
800 abort (); /* bad timing... */ 800 abort (); /* bad timing... */
801 ah = MHD_find_access_handler (connection); 801 ah = MHD_find_access_handler (connection);
802 processed = connection->readLoc; 802 processed = connection->readLoc;
@@ -827,7 +827,7 @@ MHD_call_connection_handler (struct MHD_Connection *connection)
827 ((connection->readLoc == 0) && 827 ((connection->readLoc == 0) &&
828 (connection->uploadSize == -1) && (connection->socket_fd == -1))) 828 (connection->uploadSize == -1) && (connection->socket_fd == -1)))
829 { 829 {
830 connection->bodyReceived = 1; 830 connection->bodyReceived = MHD_YES;
831 if (connection->read_buffer != NULL) 831 if (connection->read_buffer != NULL)
832 MHD_pool_reallocate (connection->pool, 832 MHD_pool_reallocate (connection->pool,
833 connection->read_buffer, 833 connection->read_buffer,
@@ -864,7 +864,7 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
864 return MHD_NO; 864 return MHD_NO;
865 } 865 }
866 if ((connection->readLoc >= connection->read_buffer_size) && 866 if ((connection->readLoc >= connection->read_buffer_size) &&
867 (connection->headersReceived == 0)) 867 (connection->headersReceived == MHD_NO))
868 { 868 {
869 /* need to grow read buffer */ 869 /* need to grow read buffer */
870 tmp = MHD_pool_reallocate (connection->pool, 870 tmp = MHD_pool_reallocate (connection->pool,
@@ -912,7 +912,7 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
912 { 912 {
913 /* other side closed connection */ 913 /* other side closed connection */
914 connection->read_close = MHD_YES; 914 connection->read_close = MHD_YES;
915 if ((connection->headersReceived == 1) && (connection->readLoc > 0)) 915 if ((connection->headersReceived == MHD_YES) && (connection->readLoc > 0))
916 MHD_call_connection_handler (connection); 916 MHD_call_connection_handler (connection);
917#if DEBUG_CLOSE 917#if DEBUG_CLOSE
918#if HAVE_MESSAGES 918#if HAVE_MESSAGES
@@ -924,9 +924,9 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
924 return MHD_YES; 924 return MHD_YES;
925 } 925 }
926 connection->readLoc += bytes_read; 926 connection->readLoc += bytes_read;
927 if (connection->headersReceived == 0) 927 if (connection->headersReceived == MHD_NO)
928 MHD_parse_connection_headers (connection); 928 MHD_parse_connection_headers (connection);
929 if ((connection->headersReceived == 1) && (connection->method != NULL)) 929 if ((connection->headersReceived == MHD_YES) && (connection->method != NULL))
930 MHD_call_connection_handler (connection); 930 MHD_call_connection_handler (connection);
931 return MHD_YES; 931 return MHD_YES;
932} 932}
@@ -1093,7 +1093,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1093#endif 1093#endif
1094 return MHD_NO; 1094 return MHD_NO;
1095 } 1095 }
1096 if (!connection->headersSent) 1096 if (MHD_NO == connection->headersSent)
1097 { 1097 {
1098 if ((connection->write_buffer == NULL) && 1098 if ((connection->write_buffer == NULL) &&
1099 (MHD_NO == MHD_build_header_response (connection))) 1099 (MHD_NO == MHD_build_header_response (connection)))
@@ -1131,7 +1131,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1131 { 1131 {
1132 connection->writeLoc = 0; 1132 connection->writeLoc = 0;
1133 connection->writePos = 0; 1133 connection->writePos = 0;
1134 connection->headersSent = 1; 1134 connection->headersSent = MHD_YES;
1135 MHD_pool_reallocate (connection->pool, 1135 MHD_pool_reallocate (connection->pool,
1136 connection->write_buffer, 1136 connection->write_buffer,
1137 connection->write_buffer_size, 0); 1137 connection->write_buffer_size, 0);
@@ -1184,8 +1184,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1184 abort (); /* internal error */ 1184 abort (); /* internal error */
1185 if (connection->messagePos == response->total_size) 1185 if (connection->messagePos == response->total_size)
1186 { 1186 {
1187 if ((connection->bodyReceived == 0) || 1187 if ((connection->bodyReceived == MHD_NO) ||
1188 (connection->headersReceived == 0)) 1188 (connection->headersReceived == MHD_NO))
1189 abort (); /* internal error */ 1189 abort (); /* internal error */
1190 MHD_destroy_response (response); 1190 MHD_destroy_response (response);
1191 if (connection->daemon->notify_completed != NULL) 1191 if (connection->daemon->notify_completed != NULL)
@@ -1199,9 +1199,9 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1199 connection->responseCode = 0; 1199 connection->responseCode = 0;
1200 connection->response = NULL; 1200 connection->response = NULL;
1201 connection->headers_received = NULL; 1201 connection->headers_received = NULL;
1202 connection->headersReceived = 0; 1202 connection->headersReceived = MHD_NO;
1203 connection->headersSent = 0; 1203 connection->headersSent = MHD_NO;
1204 connection->bodyReceived = 0; 1204 connection->bodyReceived = MHD_NO;
1205 connection->messagePos = 0; 1205 connection->messagePos = 0;
1206 connection->method = NULL; 1206 connection->method = NULL;
1207 connection->url = NULL; 1207 connection->url = NULL;