diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2015-11-04 15:23:10 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2015-11-04 15:23:10 +0000 |
commit | fcb0a20d91344e558b80a487f9d945695b61d66d (patch) | |
tree | 3c68ddd92634b6cdaa70db851125589717e5604b /src/microhttpd | |
parent | 77ffe1508f26dcd84ecbe4c628eafe0fca7894a9 (diff) | |
download | libmicrohttpd-fcb0a20d91344e558b80a487f9d945695b61d66d.tar.gz libmicrohttpd-fcb0a20d91344e558b80a487f9d945695b61d66d.zip |
connection.c: use faster and better checks for empty lines
Diffstat (limited to 'src/microhttpd')
-rw-r--r-- | src/microhttpd/connection.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 6ec51383..27dac309 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -666,7 +666,7 @@ build_header_response (struct MHD_Connection *connection) | |||
666 | int must_add_content_length; | 666 | int must_add_content_length; |
667 | 667 | ||
668 | EXTRA_CHECK (NULL != connection->version); | 668 | EXTRA_CHECK (NULL != connection->version); |
669 | if (0 == strlen (connection->version)) | 669 | if (0 == connection->version[0]) |
670 | { | 670 | { |
671 | data = MHD_pool_allocate (connection->pool, 0, MHD_YES); | 671 | data = MHD_pool_allocate (connection->pool, 0, MHD_YES); |
672 | connection->write_buffer = data; | 672 | connection->write_buffer = data; |
@@ -1796,7 +1796,7 @@ process_broken_line (struct MHD_Connection *connection, | |||
1796 | return MHD_NO; | 1796 | return MHD_NO; |
1797 | } | 1797 | } |
1798 | /* we still have the current line to deal with... */ | 1798 | /* we still have the current line to deal with... */ |
1799 | if (0 != strlen (line)) | 1799 | if (0 != line[0]) |
1800 | { | 1800 | { |
1801 | if (MHD_NO == process_header_line (connection, line)) | 1801 | if (MHD_NO == process_header_line (connection, line)) |
1802 | { | 1802 | { |
@@ -2231,7 +2231,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2231 | to tolerate 'spurious' empty lines; also | 2231 | to tolerate 'spurious' empty lines; also |
2232 | NULL means we didn't get a full line yet. */ | 2232 | NULL means we didn't get a full line yet. */ |
2233 | if ( (NULL == line) || | 2233 | if ( (NULL == line) || |
2234 | (0 == strlen (line) ) ) | 2234 | (0 == line[0]) ) |
2235 | { | 2235 | { |
2236 | if (MHD_CONNECTION_INIT != connection->state) | 2236 | if (MHD_CONNECTION_INIT != connection->state) |
2237 | continue; | 2237 | continue; |
@@ -2262,7 +2262,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2262 | } | 2262 | } |
2263 | break; | 2263 | break; |
2264 | } | 2264 | } |
2265 | if (strlen (line) == 0) | 2265 | if (0 == line[0]) |
2266 | { | 2266 | { |
2267 | connection->state = MHD_CONNECTION_HEADERS_RECEIVED; | 2267 | connection->state = MHD_CONNECTION_HEADERS_RECEIVED; |
2268 | continue; | 2268 | continue; |
@@ -2293,7 +2293,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2293 | if (MHD_NO == | 2293 | if (MHD_NO == |
2294 | process_broken_line (connection, line, MHD_HEADER_KIND)) | 2294 | process_broken_line (connection, line, MHD_HEADER_KIND)) |
2295 | continue; | 2295 | continue; |
2296 | if (0 == strlen (line)) | 2296 | if (0 == line[0]) |
2297 | { | 2297 | { |
2298 | connection->state = MHD_CONNECTION_HEADERS_RECEIVED; | 2298 | connection->state = MHD_CONNECTION_HEADERS_RECEIVED; |
2299 | continue; | 2299 | continue; |
@@ -2370,7 +2370,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2370 | } | 2370 | } |
2371 | break; | 2371 | break; |
2372 | } | 2372 | } |
2373 | if (0 == strlen (line)) | 2373 | if (0 == line[0]) |
2374 | { | 2374 | { |
2375 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; | 2375 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; |
2376 | continue; | 2376 | continue; |
@@ -2401,7 +2401,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2401 | if (MHD_NO == | 2401 | if (MHD_NO == |
2402 | process_broken_line (connection, line, MHD_FOOTER_KIND)) | 2402 | process_broken_line (connection, line, MHD_FOOTER_KIND)) |
2403 | continue; | 2403 | continue; |
2404 | if (0 == strlen (line)) | 2404 | if (0 == line[0]) |
2405 | { | 2405 | { |
2406 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; | 2406 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; |
2407 | continue; | 2407 | continue; |