diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-03 20:32:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-03 20:32:51 +0000 |
commit | 1be2534e86598800bf9f82164f859326fb63ff41 (patch) | |
tree | d23514ecae17c83b9c0acb542f39d78d2148f29f | |
parent | 3b654bd5b75ec575286492e6587d644108613590 (diff) | |
download | libmicrohttpd-1be2534e86598800bf9f82164f859326fb63ff41.tar.gz libmicrohttpd-1be2534e86598800bf9f82164f859326fb63ff41.zip |
-fix tests for MHD_USE_SUSPEND_RESUME
-rw-r--r-- | src/microhttpd/daemon.c | 18 | ||||
-rw-r--r-- | src/microhttpd/internal.c | 8 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index a8765468..f94e4630 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1395,7 +1395,7 @@ MHD_suspend_connection (struct MHD_Connection *connection) | |||
1395 | struct MHD_Daemon *daemon; | 1395 | struct MHD_Daemon *daemon; |
1396 | 1396 | ||
1397 | daemon = connection->daemon; | 1397 | daemon = connection->daemon; |
1398 | if (0 == (daemon->options & MHD_USE_SUSPEND_RESUME)) | 1398 | if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME)) |
1399 | MHD_PANIC ("Cannot suspend connections without enabling MHD_USE_SUSPEND_RESUME!\n"); | 1399 | MHD_PANIC ("Cannot suspend connections without enabling MHD_USE_SUSPEND_RESUME!\n"); |
1400 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 1400 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && |
1401 | (0 != pthread_mutex_lock (&daemon->cleanup_connection_mutex)) ) | 1401 | (0 != pthread_mutex_lock (&daemon->cleanup_connection_mutex)) ) |
@@ -1456,7 +1456,7 @@ MHD_resume_connection (struct MHD_Connection *connection) | |||
1456 | struct MHD_Daemon *daemon; | 1456 | struct MHD_Daemon *daemon; |
1457 | 1457 | ||
1458 | daemon = connection->daemon; | 1458 | daemon = connection->daemon; |
1459 | if (0 == (daemon->options & MHD_USE_SUSPEND_RESUME)) | 1459 | if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME)) |
1460 | MHD_PANIC ("Cannot resume connections without enabling MHD_USE_SUSPEND_RESUME!\n"); | 1460 | MHD_PANIC ("Cannot resume connections without enabling MHD_USE_SUSPEND_RESUME!\n"); |
1461 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 1461 | if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && |
1462 | (0 != pthread_mutex_lock (&daemon->cleanup_connection_mutex)) ) | 1462 | (0 != pthread_mutex_lock (&daemon->cleanup_connection_mutex)) ) |
@@ -2037,7 +2037,7 @@ MHD_select (struct MHD_Daemon *daemon, | |||
2037 | max = -1; | 2037 | max = -1; |
2038 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 2038 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) |
2039 | { | 2039 | { |
2040 | if (0 != (daemon->options & MHD_USE_SUSPEND_RESUME)) | 2040 | if (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) |
2041 | resume_suspended_connections (daemon); | 2041 | resume_suspended_connections (daemon); |
2042 | 2042 | ||
2043 | /* single-threaded, go over everything */ | 2043 | /* single-threaded, go over everything */ |
@@ -2117,7 +2117,7 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
2117 | struct MHD_Connection *pos; | 2117 | struct MHD_Connection *pos; |
2118 | struct MHD_Connection *next; | 2118 | struct MHD_Connection *next; |
2119 | 2119 | ||
2120 | if (0 != (daemon->options & MHD_USE_SUSPEND_RESUME)) | 2120 | if (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) |
2121 | resume_suspended_connections (daemon); | 2121 | resume_suspended_connections (daemon); |
2122 | 2122 | ||
2123 | /* count number of connections and thus determine poll set size */ | 2123 | /* count number of connections and thus determine poll set size */ |
@@ -2504,7 +2504,7 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
2504 | 2504 | ||
2505 | /* we handle resumes here because we may have ready connections | 2505 | /* we handle resumes here because we may have ready connections |
2506 | that will not be placed into the epoll list immediately. */ | 2506 | that will not be placed into the epoll list immediately. */ |
2507 | if (0 != (daemon->options & MHD_USE_SUSPEND_RESUME)) | 2507 | if (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) |
2508 | resume_suspended_connections (daemon); | 2508 | resume_suspended_connections (daemon); |
2509 | 2509 | ||
2510 | /* process events for connections */ | 2510 | /* process events for connections */ |
@@ -3115,7 +3115,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) | |||
3115 | return MHD_NO; | 3115 | return MHD_NO; |
3116 | } | 3116 | } |
3117 | if ( (-1 != daemon->wpipe[0]) && | 3117 | if ( (-1 != daemon->wpipe[0]) && |
3118 | (0 != (daemon->options & MHD_USE_SUSPEND_RESUME)) ) | 3118 | (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) ) |
3119 | { | 3119 | { |
3120 | event.events = EPOLLIN | EPOLLET; | 3120 | event.events = EPOLLIN | EPOLLET; |
3121 | event.data.ptr = NULL; | 3121 | event.data.ptr = NULL; |
@@ -3354,7 +3354,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
3354 | goto free_and_fail; | 3354 | goto free_and_fail; |
3355 | } | 3355 | } |
3356 | 3356 | ||
3357 | if ( (0 != (flags & MHD_USE_SUSPEND_RESUME)) && | 3357 | if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && |
3358 | (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) ) | 3358 | (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) ) |
3359 | { | 3359 | { |
3360 | #if HAVE_MESSAGES | 3360 | #if HAVE_MESSAGES |
@@ -3678,7 +3678,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
3678 | d->worker_pool_size = 0; | 3678 | d->worker_pool_size = 0; |
3679 | d->worker_pool = NULL; | 3679 | d->worker_pool = NULL; |
3680 | 3680 | ||
3681 | if ( (0 != (flags & MHD_USE_SUSPEND_RESUME)) && | 3681 | if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && |
3682 | #ifdef WINDOWS | 3682 | #ifdef WINDOWS |
3683 | (0 != SOCKETPAIR (AF_INET, SOCK_STREAM, IPPROTO_TCP, d->wpipe)) | 3683 | (0 != SOCKETPAIR (AF_INET, SOCK_STREAM, IPPROTO_TCP, d->wpipe)) |
3684 | #else | 3684 | #else |
@@ -3695,7 +3695,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
3695 | } | 3695 | } |
3696 | #ifndef WINDOWS | 3696 | #ifndef WINDOWS |
3697 | if ( (0 == (flags & MHD_USE_POLL)) && | 3697 | if ( (0 == (flags & MHD_USE_POLL)) && |
3698 | (0 != (flags & MHD_USE_SUSPEND_RESUME)) && | 3698 | (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && |
3699 | (d->wpipe[0] >= FD_SETSIZE) ) | 3699 | (d->wpipe[0] >= FD_SETSIZE) ) |
3700 | { | 3700 | { |
3701 | #if HAVE_MESSAGES | 3701 | #if HAVE_MESSAGES |
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c index ef286b20..9b234fea 100644 --- a/src/microhttpd/internal.c +++ b/src/microhttpd/internal.c | |||
@@ -136,6 +136,12 @@ MHD_http_unescape (void *cls, | |||
136 | rpos++; | 136 | rpos++; |
137 | break; | 137 | break; |
138 | case '%': | 138 | case '%': |
139 | if ( ('\0' == rpos[1]) || | ||
140 | ('\0' == rpos[2]) ) | ||
141 | { | ||
142 | *wpos = '\0'; | ||
143 | return wpos - val; | ||
144 | } | ||
139 | buf3[0] = rpos[1]; | 145 | buf3[0] = rpos[1]; |
140 | buf3[1] = rpos[2]; | 146 | buf3[1] = rpos[2]; |
141 | buf3[2] = '\0'; | 147 | buf3[2] = '\0'; |
@@ -159,7 +165,7 @@ MHD_http_unescape (void *cls, | |||
159 | } | 165 | } |
160 | 166 | ||
161 | 167 | ||
162 | time_t | 168 | time_t |
163 | MHD_monotonic_time (void) | 169 | MHD_monotonic_time (void) |
164 | { | 170 | { |
165 | #ifdef HAVE_CLOCK_GETTIME | 171 | #ifdef HAVE_CLOCK_GETTIME |