aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-18 09:08:53 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-18 09:08:53 +0000
commit764c0fd56b56da8aa1a2c6cec51dd46d3b7055c7 (patch)
treeb1720a565b740c1743fe75062ab42cc66f7fd2f7
parentecd561acd954650eca77c3bd93ff70b90e92dc6a (diff)
downloadlibmicrohttpd-764c0fd56b56da8aa1a2c6cec51dd46d3b7055c7.tar.gz
libmicrohttpd-764c0fd56b56da8aa1a2c6cec51dd46d3b7055c7.zip
bugfix
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog5
-rw-r--r--src/daemon/connection.c6
-rw-r--r--src/testcurl/test_callback.c66
4 files changed, 46 insertions, 32 deletions
diff --git a/AUTHORS b/AUTHORS
index 5b9c2d59..59dac571 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -32,6 +32,7 @@ Andreas Wehrmann <a.wehrmann@centersystems.com>
32Eivind Sarto <ivan@espial.com> 32Eivind Sarto <ivan@espial.com>
33Thomas Stalder <gnunet@netsolux.ch> 33Thomas Stalder <gnunet@netsolux.ch>
34Zhimin Huang <zhimin.huang@bqvision.com> 34Zhimin Huang <zhimin.huang@bqvision.com>
35Jan Seeger <jan.seeger@thenybble.de>
35 36
36Documentation contributions also came from: 37Documentation contributions also came from:
37Marco Maggi <marco.maggi-ipsu@poste.it> 38Marco Maggi <marco.maggi-ipsu@poste.it>
diff --git a/ChangeLog b/ChangeLog
index 3c3622b6..fe50b62a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
1Thu Aug 18 11:05:16 CEST 2011
2 Fixed bug with wrong state transition if callback returned
3 MHD_CONTENT_READER_END_OF_STREAM causing spurious extra callbacks
4 to the handler (thanks to Jan Seeger for pointing it out). -CG/JS
5
1Thu Aug 11 11:40:03 CEST 2011 6Thu Aug 11 11:40:03 CEST 2011
2 Changing sockets to be non-blocking as suggested by Eivind Sarto 7 Changing sockets to be non-blocking as suggested by Eivind Sarto
3 on the mailinglist. -CG 8 on the mailinglist. -CG
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index d87be33f..79a8e29b 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -390,7 +390,10 @@ try_ready_normal_body (struct MHD_Connection *connection)
390 response->data_start = connection->response_write_position; 390 response->data_start = connection->response_write_position;
391 response->data_size = ret; 391 response->data_size = ret;
392 if (ret == 0) 392 if (ret == 0)
393 return MHD_NO; 393 {
394 connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY;
395 return MHD_NO;
396 }
394 return MHD_YES; 397 return MHD_YES;
395} 398}
396 399
@@ -1847,7 +1850,6 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1847 { 1850 {
1848 if (response->crc != NULL) 1851 if (response->crc != NULL)
1849 pthread_mutex_unlock (&response->mutex); 1852 pthread_mutex_unlock (&response->mutex);
1850 connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY;
1851 break; 1853 break;
1852 } 1854 }
1853 ret = connection->send_cls (connection, 1855 ret = connection->send_cls (connection,
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index c5c34e03..cd213f44 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
97 struct timeval tv; 97 struct timeval tv;
98 int extra; 98 int extra;
99 99
100 d = MHD_start_daemon(MHD_USE_DEBUG, 100 d = MHD_start_daemon(0,
101 8000, 101 8000,
102 NULL, 102 NULL,
103 NULL, 103 NULL,
@@ -135,15 +135,18 @@ int main(int argc, char **argv)
135 FD_ZERO(&rs); 135 FD_ZERO(&rs);
136 FD_ZERO(&es); 136 FD_ZERO(&es);
137 curl_multi_perform (multi, &running); 137 curl_multi_perform (multi, &running);
138 mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); 138 if (NULL != multi)
139 if (mret != CURLM_OK) 139 {
140 { 140 mret = curl_multi_fdset (multi, &rs, &ws, &es, &max);
141 curl_multi_remove_handle (multi, c); 141 if (mret != CURLM_OK)
142 curl_multi_cleanup (multi); 142 {
143 curl_easy_cleanup (c); 143 curl_multi_remove_handle (multi, c);
144 MHD_stop_daemon (d); 144 curl_multi_cleanup (multi);
145 return 3; 145 curl_easy_cleanup (c);
146 } 146 MHD_stop_daemon (d);
147 return 3;
148 }
149 }
147 if (MHD_YES != 150 if (MHD_YES !=
148 MHD_get_fdset(d, &rs, &ws, &es, &max)) 151 MHD_get_fdset(d, &rs, &ws, &es, &max))
149 { 152 {
@@ -156,26 +159,29 @@ int main(int argc, char **argv)
156 tv.tv_sec = 0; 159 tv.tv_sec = 0;
157 tv.tv_usec = 1000; 160 tv.tv_usec = 1000;
158 select(max + 1, &rs, &ws, &es, &tv); 161 select(max + 1, &rs, &ws, &es, &tv);
159 curl_multi_perform (multi, &running); 162 if (NULL != multi)
160 if (running == 0) 163 {
161 { 164 curl_multi_perform (multi, &running);
162 msg = curl_multi_info_read (multi, &running); 165 if (running == 0)
163 if (msg == NULL) 166 {
164 break; 167 msg = curl_multi_info_read (multi, &running);
165 if (msg->msg == CURLMSG_DONE) 168 if (msg == NULL)
166 { 169 break;
167 if (msg->data.result != CURLE_OK) 170 if (msg->msg == CURLMSG_DONE)
168 printf ("%s failed at %s:%d: `%s'\n", 171 {
169 "curl_multi_perform", 172 if (msg->data.result != CURLE_OK)
170 __FILE__, 173 printf ("%s failed at %s:%d: `%s'\n",
171 __LINE__, curl_easy_strerror (msg->data.result)); 174 "curl_multi_perform",
172 curl_multi_remove_handle (multi, c); 175 __FILE__,
173 curl_multi_cleanup (multi); 176 __LINE__, curl_easy_strerror (msg->data.result));
174 curl_easy_cleanup (c); 177 curl_multi_remove_handle (multi, c);
175 c = NULL; 178 curl_multi_cleanup (multi);
176 multi = NULL; 179 curl_easy_cleanup (c);
177 } 180 c = NULL;
178 } 181 multi = NULL;
182 }
183 }
184 }
179 MHD_run(d); 185 MHD_run(d);
180 } 186 }
181 MHD_stop_daemon(d); 187 MHD_stop_daemon(d);