aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog5
-rw-r--r--src/include/microhttpd.h2
-rw-r--r--src/microhttpd/daemon.c6
-rw-r--r--src/testcurl/test_callback.c47
5 files changed, 39 insertions, 22 deletions
diff --git a/AUTHORS b/AUTHORS
index 794c1189..b9e61701 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -54,6 +54,7 @@ Guy Martin <gmsoft@tuxicoman.be>
54Robert Groenenberg <robert.groenenberg@broadforward.com> 54Robert Groenenberg <robert.groenenberg@broadforward.com>
55Denis Dowling <denis.dowling@hsd.com.au> 55Denis Dowling <denis.dowling@hsd.com.au>
56Louis Benoit <louisbenoit@videotron.ca> 56Louis Benoit <louisbenoit@videotron.ca>
57Flavio Coelin <flavio.ceolin@intel.com>
57 58
58Documentation contributions also came from: 59Documentation contributions also came from:
59Marco Maggi <marco.maggi-ipsu@poste.it> 60Marco Maggi <marco.maggi-ipsu@poste.it>
diff --git a/ChangeLog b/ChangeLog
index 7f216f5a..998e78b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
1Wed Sep 2 16:50:31 CEST 2015
2 Call resume_suspended_connections() when the user is running
3 its own mainloop and calls MHD_run_from_select() to support
4 resuming connections with external select. -FC
5
1Sun Aug 30 14:53:51 CEST 2015 6Sun Aug 30 14:53:51 CEST 2015
2 Correct documentation as to when MHD_USE_EPOLL_LINUX_ONLY 7 Correct documentation as to when MHD_USE_EPOLL_LINUX_ONLY
3 is allowed. -CG 8 is allowed. -CG
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index f40dc021..3c8f28f1 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -130,7 +130,7 @@ typedef intptr_t ssize_t;
130 * Current version of the library. 130 * Current version of the library.
131 * 0x01093001 = 1.9.30-1. 131 * 0x01093001 = 1.9.30-1.
132 */ 132 */
133#define MHD_VERSION 0x00094210 133#define MHD_VERSION 0x00094211
134 134
135/** 135/**
136 * MHD-internal return code for "YES". 136 * MHD-internal return code for "YES".
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 428b86df..40ce74b3 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2220,6 +2220,12 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
2220 char tmp; 2220 char tmp;
2221 struct MHD_Connection *pos; 2221 struct MHD_Connection *pos;
2222 struct MHD_Connection *next; 2222 struct MHD_Connection *next;
2223 unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY |
2224 MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION;
2225
2226 /* Resuming external connections when using an extern mainloop */
2227 if (MHD_USE_SUSPEND_RESUME == (daemon->options & mask))
2228 resume_suspended_connections (daemon);
2223 2229
2224#if EPOLL_SUPPORT 2230#if EPOLL_SUPPORT
2225 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 2231 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index e9095dd3..dc40aa53 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -17,59 +17,63 @@
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. 18 Boston, MA 02110-1301, USA.
19*/ 19*/
20
21/** 20/**
22 * @file test_callback.c 21 * @file test_callback.c
23 * @brief Testcase for MHD not calling the callback too often 22 * @brief Testcase for MHD not calling the callback too often
24 * @author Jan Seeger 23 * @author Jan Seeger
25 * @author Christian Grothoff 24 * @author Christian Grothoff
26 */ 25 */
27
28
29#include "MHD_config.h" 26#include "MHD_config.h"
30#include "platform.h" 27#include "platform.h"
31#include <curl/curl.h> 28#include <curl/curl.h>
32#include <microhttpd.h> 29#include <microhttpd.h>
33 30
34struct callback_closure { 31struct callback_closure
32{
35 unsigned int called; 33 unsigned int called;
36}; 34};
37 35
38 36
39static ssize_t 37static ssize_t
40called_twice(void *cls, uint64_t pos, char *buf, size_t max) 38called_twice(void *cls, uint64_t pos, char *buf, size_t max)
41{ 39{
42 struct callback_closure *cls2 = cls; 40 struct callback_closure *cls2 = cls;
43 41
44 if (cls2->called == 0) 42 if (cls2->called == 0)
45 { 43 {
46 memset(buf, 0, max); 44 memset(buf, 0, max);
47 strcat(buf, "test"); 45 strcat(buf, "test");
48 cls2->called = 1; 46 cls2->called = 1;
49 return strlen(buf); 47 return strlen(buf);
50 } 48 }
51 if (cls2->called == 1) 49 if (cls2->called == 1)
52 { 50 {
53 cls2->called = 2; 51 cls2->called = 2;
54 return MHD_CONTENT_READER_END_OF_STREAM; 52 return MHD_CONTENT_READER_END_OF_STREAM;
55 } 53 }
56 fprintf(stderr, 54 fprintf(stderr,
57 "Handler called after returning END_OF_STREAM!\n"); 55 "Handler called after returning END_OF_STREAM!\n");
58 return MHD_CONTENT_READER_END_WITH_ERROR; 56 return MHD_CONTENT_READER_END_WITH_ERROR;
59} 57}
60 58
61 59
62static int 60static int
63callback(void *cls, struct MHD_Connection *connection, const char *url, 61callback(void *cls,
64 const char *method, const char *version, const char *upload_data, 62 struct MHD_Connection *connection,
65 size_t *upload_data_size, void **con_cls) { 63 const char *url,
64 const char *method,
65 const char *version,
66 const char *upload_data,
67 size_t *upload_data_size,
68 void **con_cls)
69{
66 struct callback_closure *cbc = calloc(1, sizeof(struct callback_closure)); 70 struct callback_closure *cbc = calloc(1, sizeof(struct callback_closure));
67 struct MHD_Response *r; 71 struct MHD_Response *r;
68 72
69 r = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024, 73 r = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024,
70 &called_twice, cbc, 74 &called_twice, cbc,
71 &free); 75 &free);
72 MHD_queue_response(connection, 200, r); 76 MHD_queue_response(connection, MHD_HTTP_OK, r);
73 MHD_destroy_response(r); 77 MHD_destroy_response(r);
74 return MHD_YES; 78 return MHD_YES;
75} 79}
@@ -82,7 +86,8 @@ discard_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
82} 86}
83 87
84 88
85int main(int argc, char **argv) 89int
90main(int argc, char **argv)
86{ 91{
87 struct MHD_Daemon *d; 92 struct MHD_Daemon *d;
88 fd_set rs; 93 fd_set rs;
@@ -97,11 +102,11 @@ int main(int argc, char **argv)
97 struct timeval tv; 102 struct timeval tv;
98 int extra; 103 int extra;
99 104
100 d = MHD_start_daemon(0, 105 d = MHD_start_daemon(0,
101 8000, 106 8000,
102 NULL, 107 NULL,
103 NULL, 108 NULL,
104 callback, 109 &callback,
105 NULL, 110 NULL,
106 MHD_OPTION_END); 111 MHD_OPTION_END);
107 c = curl_easy_init (); 112 c = curl_easy_init ();
@@ -145,7 +150,7 @@ int main(int argc, char **argv)
145 curl_easy_cleanup (c); 150 curl_easy_cleanup (c);
146 MHD_stop_daemon (d); 151 MHD_stop_daemon (d);
147 return 3; 152 return 3;
148 } 153 }
149 } 154 }
150 if (MHD_YES != 155 if (MHD_YES !=
151 MHD_get_fdset(d, &rs, &ws, &es, &max)) 156 MHD_get_fdset(d, &rs, &ws, &es, &max))