diff options
author | Christian Grothoff <christian@grothoff.org> | 2007-08-15 08:59:38 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2007-08-15 08:59:38 +0000 |
commit | 2b3429e30ce710904e8af56f1e6098c981359962 (patch) | |
tree | ab27fd31f634f5fc4a0dcf52c4c505a08fe359c7 | |
parent | d2ea952b603c504aa54aa8bd390d8b4f74f65502 (diff) | |
download | libmicrohttpd-2b3429e30ce710904e8af56f1e6098c981359962.tar.gz libmicrohttpd-2b3429e30ce710904e8af56f1e6098c981359962.zip |
fix
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/daemon/connection.c | 21 | ||||
-rw-r--r-- | src/daemon/daemon.c | 143 | ||||
-rw-r--r-- | src/daemon/daemontest_get.c | 14 | ||||
-rw-r--r-- | src/daemon/daemontest_post.c | 12 | ||||
-rw-r--r-- | src/daemon/daemontest_put.c | 12 | ||||
-rw-r--r-- | src/daemon/fileserver_example.c | 3 | ||||
-rw-r--r-- | src/daemon/memorypool.c | 10 | ||||
-rw-r--r-- | src/daemon/memorypool.h | 10 | ||||
-rw-r--r-- | src/daemon/plibc.h | 776 | ||||
-rw-r--r-- | src/daemon/response.c | 7 | ||||
-rw-r--r-- | src/include/microhttpd.h | 17 |
12 files changed, 522 insertions, 506 deletions
@@ -1,7 +1,8 @@ | |||
1 | Wed Aug 15 01:46:44 MDT 2007 | 1 | Wed Aug 15 01:46:44 MDT 2007 |
2 | Extending API to allow timeout of connections. | 2 | Extending API to allow timeout of connections. |
3 | Changed API (MHD_create_response_from_callback) to | 3 | Changed API (MHD_create_response_from_callback) to |
4 | allow user to specify IO buffer size. - CG | 4 | allow user to specify IO buffer size. |
5 | Improved error handling. - CG | ||
5 | 6 | ||
6 | Tue Aug 14 19:45:49 MDT 2007 | 7 | Tue Aug 14 19:45:49 MDT 2007 |
7 | Changed license to LGPL (with consent from all contributors). | 8 | Changed license to LGPL (with consent from all contributors). |
diff --git a/src/daemon/connection.c b/src/daemon/connection.c index f65ff577..15a9be42 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman and Christian Grothoff | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
@@ -218,7 +218,7 @@ MHD_connection_get_fdset (struct MHD_Connection *connection, | |||
218 | * We ran out of memory processing the | 218 | * We ran out of memory processing the |
219 | * header. Handle it properly by stopping to read data | 219 | * header. Handle it properly by stopping to read data |
220 | * and sending a HTTP 413 or HTTP 414 response. | 220 | * and sending a HTTP 413 or HTTP 414 response. |
221 | * | 221 | * |
222 | * @param status_code the response code to send (413 or 414) | 222 | * @param status_code the response code to send (413 or 414) |
223 | */ | 223 | */ |
224 | static void | 224 | static void |
@@ -383,7 +383,7 @@ parse_arguments (enum MHD_ValueKind kind, | |||
383 | 383 | ||
384 | /** | 384 | /** |
385 | * Parse the cookie header (see RFC 2109). | 385 | * Parse the cookie header (see RFC 2109). |
386 | * | 386 | * |
387 | * @return MHD_YES for success, MHD_NO for failure (malformed, out of memory) | 387 | * @return MHD_YES for success, MHD_NO for failure (malformed, out of memory) |
388 | */ | 388 | */ |
389 | static int | 389 | static int |
@@ -597,7 +597,7 @@ MHD_parse_connection_headers (struct MHD_Connection *connection) | |||
597 | MHD_HTTP_HEADER_CONNECTION); | 597 | MHD_HTTP_HEADER_CONNECTION); |
598 | if ((end != NULL) && (0 == strcasecmp (end, "close"))) | 598 | if ((end != NULL) && (0 == strcasecmp (end, "close"))) |
599 | { | 599 | { |
600 | /* other side explicitly requested | 600 | /* other side explicitly requested |
601 | that we close the connection after | 601 | that we close the connection after |
602 | this request */ | 602 | this request */ |
603 | connection->read_close = MHD_YES; | 603 | connection->read_close = MHD_YES; |
@@ -662,7 +662,7 @@ MHD_find_access_handler (struct MHD_Connection *connection) | |||
662 | * content encoding of the POST data. And of course, | 662 | * content encoding of the POST data. And of course, |
663 | * this requires that the request is actually a | 663 | * this requires that the request is actually a |
664 | * POST request. | 664 | * POST request. |
665 | * | 665 | * |
666 | * @return MHD_YES if so | 666 | * @return MHD_YES if so |
667 | */ | 667 | */ |
668 | static int | 668 | static int |
@@ -701,12 +701,12 @@ MHD_test_post_data (struct MHD_Connection *connection) | |||
701 | * | 701 | * |
702 | * Needs to first check POST encoding and then do | 702 | * Needs to first check POST encoding and then do |
703 | * the right thing (TM). The POST data is in the | 703 | * the right thing (TM). The POST data is in the |
704 | * connection's post_data buffer between the postPos | 704 | * connection's post_data buffer between the postPos |
705 | * and postLoc offsets. The POST message maybe | 705 | * and postLoc offsets. The POST message maybe |
706 | * incomplete. The existing buffer (allocated from | 706 | * incomplete. The existing buffer (allocated from |
707 | * the pool) can be used and modified but must then | 707 | * the pool) can be used and modified but must then |
708 | * be properly removed from the struct. | 708 | * be properly removed from the struct. |
709 | * | 709 | * |
710 | * @return MHD_YES on success, MHD_NO on error (i.e. out of | 710 | * @return MHD_YES on success, MHD_NO on error (i.e. out of |
711 | * memory). | 711 | * memory). |
712 | */ | 712 | */ |
@@ -728,7 +728,7 @@ MHD_parse_post_data (struct MHD_Connection *connection) | |||
728 | /* invalidate read buffer for other uses -- | 728 | /* invalidate read buffer for other uses -- |
729 | in particular, do not give it to the | 729 | in particular, do not give it to the |
730 | client; if this were to be needed, we would | 730 | client; if this were to be needed, we would |
731 | have to make a copy, which would double memory | 731 | have to make a copy, which would double memory |
732 | requirements */ | 732 | requirements */ |
733 | connection->read_buffer_size = 0; | 733 | connection->read_buffer_size = 0; |
734 | connection->readLoc = 0; | 734 | connection->readLoc = 0; |
@@ -932,7 +932,8 @@ get_date_string (char *date, unsigned int max) | |||
932 | { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; | 932 | { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; |
933 | static const char *mons[] = | 933 | static const char *mons[] = |
934 | { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", | 934 | { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", |
935 | "Nov", "Dec" }; | 935 | "Nov", "Dec" |
936 | }; | ||
936 | struct tm now; | 937 | struct tm now; |
937 | time_t t; | 938 | time_t t; |
938 | 939 | ||
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 607f544b..26b13d35 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman and Christian Grothoff | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
@@ -64,6 +64,12 @@ MHD_register_handler (struct MHD_Daemon *daemon, | |||
64 | ah = ah->next; | 64 | ah = ah->next; |
65 | } | 65 | } |
66 | ah = malloc (sizeof (struct MHD_Access_Handler)); | 66 | ah = malloc (sizeof (struct MHD_Access_Handler)); |
67 | if (ah == NULL) | ||
68 | { | ||
69 | MHD_DLOG (daemon, "Error allocating memory: %s\n", STRERROR (errno)); | ||
70 | return MHD_NO; | ||
71 | } | ||
72 | |||
67 | ah->next = daemon->handlers; | 73 | ah->next = daemon->handlers; |
68 | ah->uri_prefix = strdup (uri_prefix); | 74 | ah->uri_prefix = strdup (uri_prefix); |
69 | ah->dh = dh; | 75 | ah->dh = dh; |
@@ -133,7 +139,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon, | |||
133 | (write_fd_set == NULL) || | 139 | (write_fd_set == NULL) || |
134 | (except_fd_set == NULL) || | 140 | (except_fd_set == NULL) || |
135 | (max_fd == NULL) || | 141 | (max_fd == NULL) || |
136 | (fd == -1) || | 142 | (fd == -1) || |
137 | (daemon->shutdown == MHD_YES) || | 143 | (daemon->shutdown == MHD_YES) || |
138 | ((daemon->options & MHD_USE_THREAD_PER_CONNECTION) != 0)) | 144 | ((daemon->options & MHD_USE_THREAD_PER_CONNECTION) != 0)) |
139 | return MHD_NO; | 145 | return MHD_NO; |
@@ -174,11 +180,10 @@ MHD_handle_connection (void *data) | |||
174 | if (con == NULL) | 180 | if (con == NULL) |
175 | abort (); | 181 | abort (); |
176 | timeout = con->daemon->connection_timeout; | 182 | timeout = con->daemon->connection_timeout; |
177 | now = time(NULL); | 183 | now = time (NULL); |
178 | while ( (!con->daemon->shutdown) && | 184 | while ((!con->daemon->shutdown) && |
179 | (con->socket_fd != -1) && | 185 | (con->socket_fd != -1) && |
180 | ( (timeout == 0) || | 186 | ((timeout == 0) || (now - timeout > con->last_activity))) |
181 | (now - timeout > con->last_activity) ) ) | ||
182 | { | 187 | { |
183 | FD_ZERO (&rs); | 188 | FD_ZERO (&rs); |
184 | FD_ZERO (&ws); | 189 | FD_ZERO (&ws); |
@@ -187,16 +192,15 @@ MHD_handle_connection (void *data) | |||
187 | MHD_connection_get_fdset (con, &rs, &ws, &es, &max); | 192 | MHD_connection_get_fdset (con, &rs, &ws, &es, &max); |
188 | tv.tv_usec = 0; | 193 | tv.tv_usec = 0; |
189 | tv.tv_sec = timeout - (now - con->last_activity); | 194 | tv.tv_sec = timeout - (now - con->last_activity); |
190 | num_ready = SELECT (max + 1, | 195 | num_ready = SELECT (max + 1, |
191 | &rs, | 196 | &rs, &ws, &es, (timeout != 0) ? &tv : NULL); |
192 | &ws, | 197 | now = time (NULL); |
193 | &es, | ||
194 | (tv.tv_sec != 0) ? &tv : NULL); | ||
195 | now = time(NULL); | ||
196 | if (num_ready < 0) | 198 | if (num_ready < 0) |
197 | { | 199 | { |
198 | if (errno == EINTR) | 200 | if (errno == EINTR) |
199 | continue; | 201 | continue; |
202 | MHD_DLOG (con->daemon, "Error during select (%d): `%s'\n", | ||
203 | max, STRERROR (errno)); | ||
200 | break; | 204 | break; |
201 | } | 205 | } |
202 | if (((FD_ISSET (con->socket_fd, &rs)) && | 206 | if (((FD_ISSET (con->socket_fd, &rs)) && |
@@ -207,10 +211,10 @@ MHD_handle_connection (void *data) | |||
207 | break; | 211 | break; |
208 | if ((con->headersReceived == 1) && (con->response == NULL)) | 212 | if ((con->headersReceived == 1) && (con->response == NULL)) |
209 | MHD_call_connection_handler (con); | 213 | MHD_call_connection_handler (con); |
210 | if ( (con->socket_fd != -1) && | 214 | if ((con->socket_fd != -1) && |
211 | ( (FD_ISSET (con->socket_fd, &rs)) || | 215 | ((FD_ISSET (con->socket_fd, &rs)) || |
212 | (FD_ISSET (con->socket_fd, &ws)) ) ) | 216 | (FD_ISSET (con->socket_fd, &ws)))) |
213 | con->last_activity = now; | 217 | con->last_activity = now; |
214 | } | 218 | } |
215 | if (con->socket_fd != -1) | 219 | if (con->socket_fd != -1) |
216 | { | 220 | { |
@@ -251,6 +255,8 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
251 | if (daemon->max_connections == 0) | 255 | if (daemon->max_connections == 0) |
252 | { | 256 | { |
253 | /* above connection limit - reject */ | 257 | /* above connection limit - reject */ |
258 | MHD_DLOG (daemon, | ||
259 | "Server reached connection limit (closing inbound connection)\n"); | ||
254 | CLOSE (s); | 260 | CLOSE (s); |
255 | return MHD_NO; | 261 | return MHD_NO; |
256 | } | 262 | } |
@@ -261,11 +267,18 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
261 | return MHD_YES; | 267 | return MHD_YES; |
262 | } | 268 | } |
263 | connection = malloc (sizeof (struct MHD_Connection)); | 269 | connection = malloc (sizeof (struct MHD_Connection)); |
270 | if (connection == NULL) | ||
271 | { | ||
272 | MHD_DLOG (daemon, "Error allocating memory: %s\n", STRERROR (errno)); | ||
273 | CLOSE (s); | ||
274 | return MHD_NO; | ||
275 | } | ||
264 | memset (connection, 0, sizeof (struct MHD_Connection)); | 276 | memset (connection, 0, sizeof (struct MHD_Connection)); |
265 | connection->pool = NULL; | 277 | connection->pool = NULL; |
266 | connection->addr = malloc (addrlen); | 278 | connection->addr = malloc (addrlen); |
267 | if (connection->addr == NULL) | 279 | if (connection->addr == NULL) |
268 | { | 280 | { |
281 | MHD_DLOG (daemon, "Error allocating memory: %s\n", STRERROR (errno)); | ||
269 | CLOSE (s); | 282 | CLOSE (s); |
270 | free (connection); | 283 | free (connection); |
271 | return MHD_NO; | 284 | return MHD_NO; |
@@ -284,7 +297,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
284 | free (connection); | 297 | free (connection); |
285 | return MHD_NO; | 298 | return MHD_NO; |
286 | } | 299 | } |
287 | connection->last_activity = time(NULL); | 300 | connection->last_activity = time (NULL); |
288 | connection->next = daemon->connections; | 301 | connection->next = daemon->connections; |
289 | daemon->connections = connection; | 302 | daemon->connections = connection; |
290 | daemon->max_connections--; | 303 | daemon->max_connections--; |
@@ -310,7 +323,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
310 | void *unused; | 323 | void *unused; |
311 | time_t timeout; | 324 | time_t timeout; |
312 | 325 | ||
313 | timeout = time(NULL); | 326 | timeout = time (NULL); |
314 | if (daemon->connection_timeout != 0) | 327 | if (daemon->connection_timeout != 0) |
315 | timeout -= daemon->connection_timeout; | 328 | timeout -= daemon->connection_timeout; |
316 | else | 329 | else |
@@ -319,11 +332,11 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
319 | prev = NULL; | 332 | prev = NULL; |
320 | while (pos != NULL) | 333 | while (pos != NULL) |
321 | { | 334 | { |
322 | if ( (pos->last_activity < timeout) && | 335 | if ((pos->last_activity < timeout) && (pos->socket_fd != -1)) |
323 | (pos->socket_fd != -1) ) { | 336 | { |
324 | CLOSE(pos->socket_fd); | 337 | CLOSE (pos->socket_fd); |
325 | pos->socket_fd = -1; | 338 | pos->socket_fd = -1; |
326 | } | 339 | } |
327 | if (pos->socket_fd == -1) | 340 | if (pos->socket_fd == -1) |
328 | { | 341 | { |
329 | if (prev == NULL) | 342 | if (prev == NULL) |
@@ -361,33 +374,33 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
361 | * (only needed if connection timeout is used). The | 374 | * (only needed if connection timeout is used). The |
362 | * returned value is how long select should at most | 375 | * returned value is how long select should at most |
363 | * block, not the timeout value set for connections. | 376 | * block, not the timeout value set for connections. |
364 | * | 377 | * |
365 | * @param timeout set to the timeout (in milliseconds) | 378 | * @param timeout set to the timeout (in milliseconds) |
366 | * @return MHD_YES on success, MHD_NO if timeouts are | 379 | * @return MHD_YES on success, MHD_NO if timeouts are |
367 | * not used (or no connections exist that would | 380 | * not used (or no connections exist that would |
368 | * necessiate the use of a timeout right now). | 381 | * necessiate the use of a timeout right now). |
369 | */ | 382 | */ |
370 | int | 383 | int |
371 | MHD_get_timeout(struct MHD_Daemon * daemon, | 384 | MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) |
372 | unsigned long long * timeout) { | 385 | { |
373 | time_t earliest_deadline; | 386 | time_t earliest_deadline; |
374 | time_t now; | 387 | time_t now; |
375 | struct MHD_Connection *pos; | 388 | struct MHD_Connection *pos; |
376 | unsigned int dto; | 389 | unsigned int dto; |
377 | 390 | ||
378 | dto = daemon->connection_timeout; | 391 | dto = daemon->connection_timeout; |
379 | if (0 == dto) | 392 | if (0 == dto) |
380 | return MHD_NO; | 393 | return MHD_NO; |
381 | pos = daemon->connections; | 394 | pos = daemon->connections; |
382 | if (pos == NULL) | 395 | if (pos == NULL) |
383 | return MHD_NO; /* no connections */ | 396 | return MHD_NO; /* no connections */ |
384 | now = time(NULL); | 397 | now = time (NULL); |
385 | /* start with conservative estimate */ | 398 | /* start with conservative estimate */ |
386 | earliest_deadline = now + dto; | 399 | earliest_deadline = now + dto; |
387 | while (pos != NULL) | 400 | while (pos != NULL) |
388 | { | 401 | { |
389 | if (earliest_deadline > pos->last_activity + dto) | 402 | if (earliest_deadline > pos->last_activity + dto) |
390 | earliest_deadline = pos->last_activity + dto; | 403 | earliest_deadline = pos->last_activity + dto; |
391 | pos = pos->next; | 404 | pos = pos->next; |
392 | } | 405 | } |
393 | if (earliest_deadline < now) | 406 | if (earliest_deadline < now) |
@@ -419,7 +432,7 @@ MHD_select (struct MHD_Daemon *daemon, int may_block) | |||
419 | 432 | ||
420 | timeout.tv_sec = 0; | 433 | timeout.tv_sec = 0; |
421 | timeout.tv_usec = 0; | 434 | timeout.tv_usec = 0; |
422 | if (daemon == NULL) | 435 | if (daemon == NULL) |
423 | abort (); | 436 | abort (); |
424 | if (daemon->shutdown == MHD_YES) | 437 | if (daemon->shutdown == MHD_YES) |
425 | return MHD_NO; | 438 | return MHD_NO; |
@@ -439,20 +452,24 @@ MHD_select (struct MHD_Daemon *daemon, int may_block) | |||
439 | /* accept only, have one thread per connection */ | 452 | /* accept only, have one thread per connection */ |
440 | max = daemon->socket_fd; | 453 | max = daemon->socket_fd; |
441 | if (max == -1) | 454 | if (max == -1) |
442 | return MHD_NO; | 455 | return MHD_NO; |
443 | FD_SET (max, &rs); | 456 | FD_SET (max, &rs); |
444 | } | 457 | } |
445 | if (may_block == MHD_NO) { | 458 | if (may_block == MHD_NO) |
446 | timeout.tv_usec = 0; | 459 | { |
447 | timeout.tv_sec = 0; | 460 | timeout.tv_usec = 0; |
448 | } else { | 461 | timeout.tv_sec = 0; |
449 | /* ltimeout is in ms */ | 462 | } |
450 | if (MHD_YES == MHD_get_timeout(daemon, <imeout)) { | 463 | else |
451 | timeout.tv_usec = (ltimeout % 1000) * 1000 * 1000; | 464 | { |
452 | timeout.tv_sec = ltimeout / 1000; | 465 | /* ltimeout is in ms */ |
453 | may_block = MHD_NO; | 466 | if (MHD_YES == MHD_get_timeout (daemon, <imeout)) |
454 | } | 467 | { |
455 | } | 468 | timeout.tv_usec = (ltimeout % 1000) * 1000 * 1000; |
469 | timeout.tv_sec = ltimeout / 1000; | ||
470 | may_block = MHD_NO; | ||
471 | } | ||
472 | } | ||
456 | num_ready = SELECT (max + 1, | 473 | num_ready = SELECT (max + 1, |
457 | &rs, &ws, &es, may_block == MHD_NO ? &timeout : NULL); | 474 | &rs, &ws, &es, may_block == MHD_NO ? &timeout : NULL); |
458 | if (daemon->shutdown == MHD_YES) | 475 | if (daemon->shutdown == MHD_YES) |
@@ -472,24 +489,24 @@ MHD_select (struct MHD_Daemon *daemon, int may_block) | |||
472 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 489 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) |
473 | { | 490 | { |
474 | /* do not have a thread per connection, process all connections now */ | 491 | /* do not have a thread per connection, process all connections now */ |
475 | now = time(NULL); | 492 | now = time (NULL); |
476 | pos = daemon->connections; | 493 | pos = daemon->connections; |
477 | while (pos != NULL) | 494 | while (pos != NULL) |
478 | { | 495 | { |
479 | ds = pos->socket_fd; | 496 | ds = pos->socket_fd; |
480 | if (ds == -1) | 497 | if (ds != -1) |
481 | { | 498 | { |
482 | pos = pos->next; | 499 | if (FD_ISSET (ds, &rs)) |
483 | continue; | 500 | { |
501 | pos->last_activity = now; | ||
502 | MHD_connection_handle_read (pos); | ||
503 | } | ||
504 | if (FD_ISSET (ds, &ws)) | ||
505 | { | ||
506 | pos->last_activity = now; | ||
507 | MHD_connection_handle_write (pos); | ||
508 | } | ||
484 | } | 509 | } |
485 | if (FD_ISSET (ds, &rs)) { | ||
486 | pos->last_activity = now; | ||
487 | MHD_connection_handle_read (pos); | ||
488 | } | ||
489 | if (FD_ISSET (ds, &ws)) { | ||
490 | pos->last_activity = now; | ||
491 | MHD_connection_handle_write (pos); | ||
492 | } | ||
493 | pos = pos->next; | 510 | pos = pos->next; |
494 | } | 511 | } |
495 | } | 512 | } |
@@ -629,7 +646,7 @@ MHD_start_daemon (unsigned int options, | |||
629 | retVal->default_handler.next = NULL; | 646 | retVal->default_handler.next = NULL; |
630 | retVal->max_connections = MHD_MAX_CONNECTIONS_DEFAULT; | 647 | retVal->max_connections = MHD_MAX_CONNECTIONS_DEFAULT; |
631 | retVal->pool_size = MHD_POOL_SIZE_DEFAULT; | 648 | retVal->pool_size = MHD_POOL_SIZE_DEFAULT; |
632 | retVal->connection_timeout = 0; /* no timeout */ | 649 | retVal->connection_timeout = 0; /* no timeout */ |
633 | va_start (ap, dh_cls); | 650 | va_start (ap, dh_cls); |
634 | while (MHD_OPTION_END != (opt = va_arg (ap, enum MHD_OPTION))) | 651 | while (MHD_OPTION_END != (opt = va_arg (ap, enum MHD_OPTION))) |
635 | { | 652 | { |
@@ -641,9 +658,9 @@ MHD_start_daemon (unsigned int options, | |||
641 | case MHD_OPTION_CONNECTION_LIMIT: | 658 | case MHD_OPTION_CONNECTION_LIMIT: |
642 | retVal->max_connections = va_arg (ap, unsigned int); | 659 | retVal->max_connections = va_arg (ap, unsigned int); |
643 | break; | 660 | break; |
644 | case MHD_OPTION_CONNECTION_TIMEOUT: | 661 | case MHD_OPTION_CONNECTION_TIMEOUT: |
645 | retVal->connection_timeout = va_arg (ap, unsigned int); | 662 | retVal->connection_timeout = va_arg (ap, unsigned int); |
646 | break; | 663 | break; |
647 | default: | 664 | default: |
648 | fprintf (stderr, | 665 | fprintf (stderr, |
649 | "Invalid MHD_OPTION argument! (Did you terminate the list with MHD_OPTION_END?)\n"); | 666 | "Invalid MHD_OPTION argument! (Did you terminate the list with MHD_OPTION_END?)\n"); |
@@ -728,12 +745,12 @@ void __attribute__ ((destructor)) MHD_pthread_handlers_ltdl_fini () | |||
728 | #else | 745 | #else |
729 | void __attribute__ ((constructor)) MHD_win_ltdl_init () | 746 | void __attribute__ ((constructor)) MHD_win_ltdl_init () |
730 | { | 747 | { |
731 | plibc_init("CRISP", "libmicrohttpd"); | 748 | plibc_init ("CRISP", "libmicrohttpd"); |
732 | } | 749 | } |
733 | 750 | ||
734 | void __attribute__ ((destructor)) MHD_win_ltdl_fini () | 751 | void __attribute__ ((destructor)) MHD_win_ltdl_fini () |
735 | { | 752 | { |
736 | plibc_shutdown(); | 753 | plibc_shutdown (); |
737 | } | 754 | } |
738 | #endif | 755 | #endif |
739 | 756 | ||
diff --git a/src/daemon/daemontest_get.c b/src/daemon/daemontest_get.c index 01612dfa..f5ef084f 100644 --- a/src/daemon/daemontest_get.c +++ b/src/daemon/daemontest_get.c | |||
@@ -112,9 +112,9 @@ testInternalGet () | |||
112 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | 112 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); |
113 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 113 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
114 | { | 114 | { |
115 | fprintf(stderr, | 115 | fprintf (stderr, |
116 | "curl_easy_perform failed: `%s'\n", | 116 | "curl_easy_perform failed: `%s'\n", |
117 | curl_easy_strerror(errornum)); | 117 | curl_easy_strerror (errornum)); |
118 | curl_easy_cleanup (c); | 118 | curl_easy_cleanup (c); |
119 | MHD_stop_daemon (d); | 119 | MHD_stop_daemon (d); |
120 | return 2; | 120 | return 2; |
@@ -169,9 +169,9 @@ testMultithreadedGet () | |||
169 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | 169 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); |
170 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 170 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
171 | { | 171 | { |
172 | fprintf(stderr, | 172 | fprintf (stderr, |
173 | "curl_easy_perform failed: `%s'\n", | 173 | "curl_easy_perform failed: `%s'\n", |
174 | curl_easy_strerror(errornum)); | 174 | curl_easy_strerror (errornum)); |
175 | curl_easy_cleanup (c); | 175 | curl_easy_cleanup (c); |
176 | MHD_stop_daemon (d); | 176 | MHD_stop_daemon (d); |
177 | return 32; | 177 | return 32; |
@@ -321,13 +321,11 @@ int | |||
321 | main (int argc, char *const *argv) | 321 | main (int argc, char *const *argv) |
322 | { | 322 | { |
323 | unsigned int errorCount = 0; | 323 | unsigned int errorCount = 0; |
324 | // int i; | ||
325 | 324 | ||
326 | oneone = NULL != strstr (argv[0], "11"); | 325 | oneone = NULL != strstr (argv[0], "11"); |
327 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) | 326 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) |
328 | return 2; | 327 | return 2; |
329 | errorCount += testInternalGet (); | 328 | errorCount += testInternalGet (); |
330 | // for (i=0;i<10000;i++) | ||
331 | errorCount += testMultithreadedGet (); | 329 | errorCount += testMultithreadedGet (); |
332 | errorCount += testExternalGet (); | 330 | errorCount += testExternalGet (); |
333 | if (errorCount != 0) | 331 | if (errorCount != 0) |
diff --git a/src/daemon/daemontest_post.c b/src/daemon/daemontest_post.c index eed25e1d..6764450e 100644 --- a/src/daemon/daemontest_post.c +++ b/src/daemon/daemontest_post.c | |||
@@ -134,9 +134,9 @@ testInternalPost () | |||
134 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | 134 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); |
135 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 135 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
136 | { | 136 | { |
137 | fprintf(stderr, | 137 | fprintf (stderr, |
138 | "curl_easy_perform failed: `%s'\n", | 138 | "curl_easy_perform failed: `%s'\n", |
139 | curl_easy_strerror(errornum)); | 139 | curl_easy_strerror (errornum)); |
140 | curl_easy_cleanup (c); | 140 | curl_easy_cleanup (c); |
141 | MHD_stop_daemon (d); | 141 | MHD_stop_daemon (d); |
142 | return 2; | 142 | return 2; |
@@ -194,9 +194,9 @@ testMultithreadedPost () | |||
194 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | 194 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); |
195 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 195 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
196 | { | 196 | { |
197 | fprintf(stderr, | 197 | fprintf (stderr, |
198 | "curl_easy_perform failed: `%s'\n", | 198 | "curl_easy_perform failed: `%s'\n", |
199 | curl_easy_strerror(errornum)); | 199 | curl_easy_strerror (errornum)); |
200 | curl_easy_cleanup (c); | 200 | curl_easy_cleanup (c); |
201 | MHD_stop_daemon (d); | 201 | MHD_stop_daemon (d); |
202 | return 32; | 202 | return 32; |
diff --git a/src/daemon/daemontest_put.c b/src/daemon/daemontest_put.c index 7c047887..198eb0f8 100644 --- a/src/daemon/daemontest_put.c +++ b/src/daemon/daemontest_put.c | |||
@@ -148,9 +148,9 @@ testInternalPut () | |||
148 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | 148 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); |
149 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 149 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
150 | { | 150 | { |
151 | fprintf(stderr, | 151 | fprintf (stderr, |
152 | "curl_easy_perform failed: `%s'\n", | 152 | "curl_easy_perform failed: `%s'\n", |
153 | curl_easy_strerror(errornum)); | 153 | curl_easy_strerror (errornum)); |
154 | curl_easy_cleanup (c); | 154 | curl_easy_cleanup (c); |
155 | MHD_stop_daemon (d); | 155 | MHD_stop_daemon (d); |
156 | return 2; | 156 | return 2; |
@@ -212,9 +212,9 @@ testMultithreadedPut () | |||
212 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | 212 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); |
213 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 213 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
214 | { | 214 | { |
215 | fprintf(stderr, | 215 | fprintf (stderr, |
216 | "curl_easy_perform failed: `%s'\n", | 216 | "curl_easy_perform failed: `%s'\n", |
217 | curl_easy_strerror(errornum)); | 217 | curl_easy_strerror (errornum)); |
218 | curl_easy_cleanup (c); | 218 | curl_easy_cleanup (c); |
219 | MHD_stop_daemon (d); | 219 | MHD_stop_daemon (d); |
220 | return 32; | 220 | return 32; |
diff --git a/src/daemon/fileserver_example.c b/src/daemon/fileserver_example.c index 7574cd20..85b154e3 100644 --- a/src/daemon/fileserver_example.c +++ b/src/daemon/fileserver_example.c | |||
@@ -73,8 +73,7 @@ ahc_echo (void *cls, | |||
73 | else | 73 | else |
74 | { | 74 | { |
75 | stat (&url[1], &buf); | 75 | stat (&url[1], &buf); |
76 | response = MHD_create_response_from_callback (buf.st_size, | 76 | response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k page size */ |
77 | 32 * 1024, /* 32k page size */ | ||
78 | &file_reader, | 77 | &file_reader, |
79 | file, | 78 | file, |
80 | (MHD_ContentReaderFreeCallback) | 79 | (MHD_ContentReaderFreeCallback) |
diff --git a/src/daemon/memorypool.c b/src/daemon/memorypool.c index cc51dd77..fa0b4d6b 100644 --- a/src/daemon/memorypool.c +++ b/src/daemon/memorypool.c | |||
@@ -56,7 +56,7 @@ struct MemoryPool | |||
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Create a memory pool. | 58 | * Create a memory pool. |
59 | * | 59 | * |
60 | * @param max maximum size of the pool | 60 | * @param max maximum size of the pool |
61 | */ | 61 | */ |
62 | struct MemoryPool * | 62 | struct MemoryPool * |
@@ -133,16 +133,16 @@ MHD_pool_allocate (struct MemoryPool *pool, unsigned int size, int from_end) | |||
133 | * Reallocate a block of memory obtained from the pool. | 133 | * Reallocate a block of memory obtained from the pool. |
134 | * This is particularly efficient when growing or | 134 | * This is particularly efficient when growing or |
135 | * shrinking the block that was last (re)allocated. | 135 | * shrinking the block that was last (re)allocated. |
136 | * If the given block is not the most recenlty | 136 | * If the given block is not the most recenlty |
137 | * (re)allocated block, the memory of the previous | 137 | * (re)allocated block, the memory of the previous |
138 | * allocation may be leaked until the pool is | 138 | * allocation may be leaked until the pool is |
139 | * destroyed (and copying the data maybe required). | 139 | * destroyed (and copying the data maybe required). |
140 | * | 140 | * |
141 | * @param old the existing block | 141 | * @param old the existing block |
142 | * @param old_size the size of the existing block | 142 | * @param old_size the size of the existing block |
143 | * @param new_size the new size of the block | 143 | * @param new_size the new size of the block |
144 | * @return new address of the block, or | 144 | * @return new address of the block, or |
145 | * NULL if the pool cannot support new_size | 145 | * NULL if the pool cannot support new_size |
146 | * bytes (old continues to be valid for old_size) | 146 | * bytes (old continues to be valid for old_size) |
147 | */ | 147 | */ |
148 | void * | 148 | void * |
diff --git a/src/daemon/memorypool.h b/src/daemon/memorypool.h index f7704cf5..7f53cba5 100644 --- a/src/daemon/memorypool.h +++ b/src/daemon/memorypool.h | |||
@@ -39,7 +39,7 @@ struct MemoryPool; | |||
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Create a memory pool. | 41 | * Create a memory pool. |
42 | * | 42 | * |
43 | * @param max maximum size of the pool | 43 | * @param max maximum size of the pool |
44 | */ | 44 | */ |
45 | struct MemoryPool *MHD_pool_create (unsigned int max); | 45 | struct MemoryPool *MHD_pool_create (unsigned int max); |
@@ -65,16 +65,16 @@ void *MHD_pool_allocate (struct MemoryPool *pool, | |||
65 | * Reallocate a block of memory obtained from the pool. | 65 | * Reallocate a block of memory obtained from the pool. |
66 | * This is particularly efficient when growing or | 66 | * This is particularly efficient when growing or |
67 | * shrinking the block that was last (re)allocated. | 67 | * shrinking the block that was last (re)allocated. |
68 | * If the given block is not the most recenlty | 68 | * If the given block is not the most recenlty |
69 | * (re)allocated block, the memory of the previous | 69 | * (re)allocated block, the memory of the previous |
70 | * allocation may be leaked until the pool is | 70 | * allocation may be leaked until the pool is |
71 | * destroyed (and copying the data maybe required). | 71 | * destroyed (and copying the data maybe required). |
72 | * | 72 | * |
73 | * @param old the existing block | 73 | * @param old the existing block |
74 | * @param old_size the size of the existing block | 74 | * @param old_size the size of the existing block |
75 | * @param new_size the new size of the block | 75 | * @param new_size the new size of the block |
76 | * @return new address of the block, or | 76 | * @return new address of the block, or |
77 | * NULL if the pool cannot support new_size | 77 | * NULL if the pool cannot support new_size |
78 | * bytes (old continues to be valid for old_size) | 78 | * bytes (old continues to be valid for old_size) |
79 | */ | 79 | */ |
80 | void *MHD_pool_reallocate (struct MemoryPool *pool, | 80 | void *MHD_pool_reallocate (struct MemoryPool *pool, |
diff --git a/src/daemon/plibc.h b/src/daemon/plibc.h index 92cd8035..8eafcc89 100644 --- a/src/daemon/plibc.h +++ b/src/daemon/plibc.h | |||
@@ -29,21 +29,22 @@ | |||
29 | #define _PLIBC_H_ | 29 | #define _PLIBC_H_ |
30 | 30 | ||
31 | #ifndef SIGALRM | 31 | #ifndef SIGALRM |
32 | #define SIGALRM 14 | 32 | #define SIGALRM 14 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifdef __cplusplus | 35 | #ifdef __cplusplus |
36 | extern "C" { | 36 | extern "C" |
37 | { | ||
37 | #endif | 38 | #endif |
38 | 39 | ||
39 | #ifdef Q_OS_WIN32 | 40 | #ifdef Q_OS_WIN32 |
40 | #define WINDOWS 1 | 41 | #define WINDOWS 1 |
41 | #endif | 42 | #endif |
42 | 43 | ||
43 | #ifdef WINDOWS | 44 | #ifdef WINDOWS |
44 | 45 | ||
45 | #if ENABLE_NLS | 46 | #if ENABLE_NLS |
46 | #include "langinfo.h" | 47 | #include "langinfo.h" |
47 | #endif | 48 | #endif |
48 | 49 | ||
49 | #include <windows.h> | 50 | #include <windows.h> |
@@ -75,8 +76,8 @@ extern "C" { | |||
75 | #define int64_t long long | 76 | #define int64_t long long |
76 | #define int32_t long | 77 | #define int32_t long |
77 | 78 | ||
78 | struct stat64 | 79 | struct stat64 |
79 | { | 80 | { |
80 | _dev_t st_dev; | 81 | _dev_t st_dev; |
81 | _ino_t st_ino; | 82 | _ino_t st_ino; |
82 | _mode_t st_mode; | 83 | _mode_t st_mode; |
@@ -88,112 +89,112 @@ struct stat64 | |||
88 | __time64_t st_atime; | 89 | __time64_t st_atime; |
89 | __time64_t st_mtime; | 90 | __time64_t st_mtime; |
90 | __time64_t st_ctime; | 91 | __time64_t st_ctime; |
91 | }; | 92 | }; |
92 | 93 | ||
93 | #ifndef pid_t | 94 | #ifndef pid_t |
94 | #define pid_t int | 95 | #define pid_t int |
95 | #endif | 96 | #endif |
96 | 97 | ||
97 | #ifndef WEXITSTATUS | 98 | #ifndef WEXITSTATUS |
98 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | 99 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
99 | #endif | 100 | #endif |
100 | 101 | ||
101 | /* Thanks to the Cygwin project */ | 102 | /* Thanks to the Cygwin project */ |
102 | #define ENOCSI 43 /* No CSI structure available */ | 103 | #define ENOCSI 43 /* No CSI structure available */ |
103 | #define EL2HLT 44 /* Level 2 halted */ | 104 | #define EL2HLT 44 /* Level 2 halted */ |
104 | #ifndef EDEADLK | 105 | #ifndef EDEADLK |
105 | #define EDEADLK 45 /* Deadlock condition */ | 106 | #define EDEADLK 45 /* Deadlock condition */ |
106 | #endif | 107 | #endif |
107 | #ifndef ENOLCK | 108 | #ifndef ENOLCK |
108 | #define ENOLCK 46 /* No record locks available */ | 109 | #define ENOLCK 46 /* No record locks available */ |
109 | #endif | 110 | #endif |
110 | #define EBADE 50 /* Invalid exchange */ | 111 | #define EBADE 50 /* Invalid exchange */ |
111 | #define EBADR 51 /* Invalid request descriptor */ | 112 | #define EBADR 51 /* Invalid request descriptor */ |
112 | #define EXFULL 52 /* Exchange full */ | 113 | #define EXFULL 52 /* Exchange full */ |
113 | #define ENOANO 53 /* No anode */ | 114 | #define ENOANO 53 /* No anode */ |
114 | #define EBADRQC 54 /* Invalid request code */ | 115 | #define EBADRQC 54 /* Invalid request code */ |
115 | #define EBADSLT 55 /* Invalid slot */ | 116 | #define EBADSLT 55 /* Invalid slot */ |
116 | #ifndef EDEADLOCK | 117 | #ifndef EDEADLOCK |
117 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ | 118 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ |
118 | #endif | 119 | #endif |
119 | #define EBFONT 57 /* Bad font file fmt */ | 120 | #define EBFONT 57 /* Bad font file fmt */ |
120 | #define ENOSTR 60 /* Device not a stream */ | 121 | #define ENOSTR 60 /* Device not a stream */ |
121 | #define ENODATA 61 /* No data (for no delay io) */ | 122 | #define ENODATA 61 /* No data (for no delay io) */ |
122 | #define ETIME 62 /* Timer expired */ | 123 | #define ETIME 62 /* Timer expired */ |
123 | #define ENOSR 63 /* Out of streams resources */ | 124 | #define ENOSR 63 /* Out of streams resources */ |
124 | #define ENONET 64 /* Machine is not on the network */ | 125 | #define ENONET 64 /* Machine is not on the network */ |
125 | #define ENOPKG 65 /* Package not installed */ | 126 | #define ENOPKG 65 /* Package not installed */ |
126 | #define EREMOTE 66 /* The object is remote */ | 127 | #define EREMOTE 66 /* The object is remote */ |
127 | #define ENOLINK 67 /* The link has been severed */ | 128 | #define ENOLINK 67 /* The link has been severed */ |
128 | #define EADV 68 /* Advertise error */ | 129 | #define EADV 68 /* Advertise error */ |
129 | #define ESRMNT 69 /* Srmount error */ | 130 | #define ESRMNT 69 /* Srmount error */ |
130 | #define ECOMM 70 /* Communication error on send */ | 131 | #define ECOMM 70 /* Communication error on send */ |
131 | #define EPROTO 71 /* Protocol error */ | 132 | #define EPROTO 71 /* Protocol error */ |
132 | #define EMULTIHOP 74 /* Multihop attempted */ | 133 | #define EMULTIHOP 74 /* Multihop attempted */ |
133 | #define ELBIN 75 /* Inode is remote (not really error) */ | 134 | #define ELBIN 75 /* Inode is remote (not really error) */ |
134 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | 135 | #define EDOTDOT 76 /* Cross mount point (not really error) */ |
135 | #define EBADMSG 77 /* Trying to read unreadable message */ | 136 | #define EBADMSG 77 /* Trying to read unreadable message */ |
136 | #define ENOTUNIQ 80 /* Given log. name not unique */ | 137 | #define ENOTUNIQ 80 /* Given log. name not unique */ |
137 | #define EBADFD 81 /* f.d. invalid for this operation */ | 138 | #define EBADFD 81 /* f.d. invalid for this operation */ |
138 | #define EREMCHG 82 /* Remote address changed */ | 139 | #define EREMCHG 82 /* Remote address changed */ |
139 | #define ELIBACC 83 /* Can't access a needed shared lib */ | 140 | #define ELIBACC 83 /* Can't access a needed shared lib */ |
140 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | 141 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
141 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | 142 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ |
142 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | 143 | #define ELIBMAX 86 /* Attempting to link in too many libs */ |
143 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | 144 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ |
144 | #ifndef ENOSYS | 145 | #ifndef ENOSYS |
145 | #define ENOSYS 88 /* Function not implemented */ | 146 | #define ENOSYS 88 /* Function not implemented */ |
146 | #endif | 147 | #endif |
147 | #define ENMFILE 89 /* No more files */ | 148 | #define ENMFILE 89 /* No more files */ |
148 | #ifndef ENOTEMPTY | 149 | #ifndef ENOTEMPTY |
149 | #define ENOTEMPTY 90 /* Directory not empty */ | 150 | #define ENOTEMPTY 90 /* Directory not empty */ |
150 | #endif | 151 | #endif |
151 | #ifndef ENAMETOOLONG | 152 | #ifndef ENAMETOOLONG |
152 | #define ENAMETOOLONG 91 /* File or path name too long */ | 153 | #define ENAMETOOLONG 91 /* File or path name too long */ |
153 | #endif | 154 | #endif |
154 | #define ELOOP 92 /* Too many symbolic links */ | 155 | #define ELOOP 92 /* Too many symbolic links */ |
155 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | 156 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
156 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | 157 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
157 | #define ECONNRESET 104 /* Connection reset by peer */ | 158 | #define ECONNRESET 104 /* Connection reset by peer */ |
158 | #define ENOBUFS 105 /* No buffer space available */ | 159 | #define ENOBUFS 105 /* No buffer space available */ |
159 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | 160 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ |
160 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | 161 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ |
161 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | 162 | #define ENOTSOCK 108 /* Socket operation on non-socket */ |
162 | #define ENOPROTOOPT 109 /* Protocol not available */ | 163 | #define ENOPROTOOPT 109 /* Protocol not available */ |
163 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | 164 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ |
164 | #define ECONNREFUSED 111 /* Connection refused */ | 165 | #define ECONNREFUSED 111 /* Connection refused */ |
165 | #define EADDRINUSE 112 /* Address already in use */ | 166 | #define EADDRINUSE 112 /* Address already in use */ |
166 | #define ECONNABORTED 113 /* Connection aborted */ | 167 | #define ECONNABORTED 113 /* Connection aborted */ |
167 | #define ENETUNREACH 114 /* Network is unreachable */ | 168 | #define ENETUNREACH 114 /* Network is unreachable */ |
168 | #define ENETDOWN 115 /* Network interface is not configured */ | 169 | #define ENETDOWN 115 /* Network interface is not configured */ |
169 | #ifndef ETIMEDOUT | 170 | #ifndef ETIMEDOUT |
170 | #define ETIMEDOUT 116 /* Connection timed out */ | 171 | #define ETIMEDOUT 116 /* Connection timed out */ |
171 | #endif | 172 | #endif |
172 | #define EHOSTDOWN 117 /* Host is down */ | 173 | #define EHOSTDOWN 117 /* Host is down */ |
173 | #define EHOSTUNREACH 118 /* Host is unreachable */ | 174 | #define EHOSTUNREACH 118 /* Host is unreachable */ |
174 | #define EINPROGRESS 119 /* Connection already in progress */ | 175 | #define EINPROGRESS 119 /* Connection already in progress */ |
175 | #define EALREADY 120 /* Socket already connected */ | 176 | #define EALREADY 120 /* Socket already connected */ |
176 | #define EDESTADDRREQ 121 /* Destination address required */ | 177 | #define EDESTADDRREQ 121 /* Destination address required */ |
177 | #define EMSGSIZE 122 /* Message too long */ | 178 | #define EMSGSIZE 122 /* Message too long */ |
178 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | 179 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ |
179 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | 180 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ |
180 | #define EADDRNOTAVAIL 125 /* Address not available */ | 181 | #define EADDRNOTAVAIL 125 /* Address not available */ |
181 | #define ENETRESET 126 /* Connection aborted by network */ | 182 | #define ENETRESET 126 /* Connection aborted by network */ |
182 | #define EISCONN 127 /* Socket is already connected */ | 183 | #define EISCONN 127 /* Socket is already connected */ |
183 | #define ENOTCONN 128 /* Socket is not connected */ | 184 | #define ENOTCONN 128 /* Socket is not connected */ |
184 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | 185 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ |
185 | #define EPROCLIM 130 /* Too many processes */ | 186 | #define EPROCLIM 130 /* Too many processes */ |
186 | #define EUSERS 131 /* Too many users */ | 187 | #define EUSERS 131 /* Too many users */ |
187 | #define EDQUOT 132 /* Disk quota exceeded */ | 188 | #define EDQUOT 132 /* Disk quota exceeded */ |
188 | #define ESTALE 133 /* Unknown error */ | 189 | #define ESTALE 133 /* Unknown error */ |
189 | #ifndef ENOTSUP | 190 | #ifndef ENOTSUP |
190 | #define ENOTSUP 134 /* Not supported */ | 191 | #define ENOTSUP 134 /* Not supported */ |
191 | #endif | 192 | #endif |
192 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | 193 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ |
193 | #define ENOSHARE 136 /* No such host or network path */ | 194 | #define ENOSHARE 136 /* No such host or network path */ |
194 | #define ECASECLASH 137 /* Filename exists with different case */ | 195 | #define ECASECLASH 137 /* Filename exists with different case */ |
195 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 196 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
196 | #define EOVERFLOW 139 /* Value too large for defined data type */ | 197 | #define EOVERFLOW 139 /* Value too large for defined data type */ |
197 | 198 | ||
198 | #undef HOST_NOT_FOUND | 199 | #undef HOST_NOT_FOUND |
199 | #define HOST_NOT_FOUND 1 | 200 | #define HOST_NOT_FOUND 1 |
@@ -207,65 +208,65 @@ struct stat64 | |||
207 | #define PROT_READ 0x1 | 208 | #define PROT_READ 0x1 |
208 | #define PROT_WRITE 0x2 | 209 | #define PROT_WRITE 0x2 |
209 | #define MAP_SHARED 0x1 | 210 | #define MAP_SHARED 0x1 |
210 | #define MAP_PRIVATE 0x2 /* unsupported */ | 211 | #define MAP_PRIVATE 0x2 /* unsupported */ |
211 | #define MAP_FIXED 0x10 | 212 | #define MAP_FIXED 0x10 |
212 | #define MAP_FAILED ((void *)-1) | 213 | #define MAP_FAILED ((void *)-1) |
213 | 214 | ||
214 | struct statfs | 215 | struct statfs |
215 | { | 216 | { |
216 | long f_type; /* type of filesystem (see below) */ | 217 | long f_type; /* type of filesystem (see below) */ |
217 | long f_bsize; /* optimal transfer block size */ | 218 | long f_bsize; /* optimal transfer block size */ |
218 | long f_blocks; /* total data blocks in file system */ | 219 | long f_blocks; /* total data blocks in file system */ |
219 | long f_bfree; /* free blocks in fs */ | 220 | long f_bfree; /* free blocks in fs */ |
220 | long f_bavail; /* free blocks avail to non-superuser */ | 221 | long f_bavail; /* free blocks avail to non-superuser */ |
221 | long f_files; /* total file nodes in file system */ | 222 | long f_files; /* total file nodes in file system */ |
222 | long f_ffree; /* free file nodes in fs */ | 223 | long f_ffree; /* free file nodes in fs */ |
223 | long f_fsid; /* file system id */ | 224 | long f_fsid; /* file system id */ |
224 | long f_namelen; /* maximum length of filenames */ | 225 | long f_namelen; /* maximum length of filenames */ |
225 | long f_spare[6]; /* spare for later */ | 226 | long f_spare[6]; /* spare for later */ |
226 | }; | 227 | }; |
227 | 228 | ||
228 | /* Taken from the Wine project <http://www.winehq.org> | 229 | /* Taken from the Wine project <http://www.winehq.org> |
229 | /wine/include/winternl.h */ | 230 | /wine/include/winternl.h */ |
230 | enum SYSTEM_INFORMATION_CLASS | 231 | enum SYSTEM_INFORMATION_CLASS |
231 | { | 232 | { |
232 | SystemBasicInformation = 0, | 233 | SystemBasicInformation = 0, |
233 | Unknown1, | 234 | Unknown1, |
234 | SystemPerformanceInformation = 2, | 235 | SystemPerformanceInformation = 2, |
235 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | 236 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ |
236 | Unknown4, | 237 | Unknown4, |
237 | SystemProcessInformation = 5, | 238 | SystemProcessInformation = 5, |
238 | Unknown6, | 239 | Unknown6, |
239 | Unknown7, | 240 | Unknown7, |
240 | SystemProcessorPerformanceInformation = 8, | 241 | SystemProcessorPerformanceInformation = 8, |
241 | Unknown9, | 242 | Unknown9, |
242 | Unknown10, | 243 | Unknown10, |
243 | SystemDriverInformation, | 244 | SystemDriverInformation, |
244 | Unknown12, | 245 | Unknown12, |
245 | Unknown13, | 246 | Unknown13, |
246 | Unknown14, | 247 | Unknown14, |
247 | Unknown15, | 248 | Unknown15, |
248 | SystemHandleList, | 249 | SystemHandleList, |
249 | Unknown17, | 250 | Unknown17, |
250 | Unknown18, | 251 | Unknown18, |
251 | Unknown19, | 252 | Unknown19, |
252 | Unknown20, | 253 | Unknown20, |
253 | SystemCacheInformation, | 254 | SystemCacheInformation, |
254 | Unknown22, | 255 | Unknown22, |
255 | SystemInterruptInformation = 23, | 256 | SystemInterruptInformation = 23, |
256 | SystemExceptionInformation = 33, | 257 | SystemExceptionInformation = 33, |
257 | SystemRegistryQuotaInformation = 37, | 258 | SystemRegistryQuotaInformation = 37, |
258 | SystemLookasideInformation = 45 | 259 | SystemLookasideInformation = 45 |
259 | }; | 260 | }; |
260 | 261 | ||
261 | typedef struct | 262 | typedef struct |
262 | { | 263 | { |
263 | LARGE_INTEGER IdleTime; | 264 | LARGE_INTEGER IdleTime; |
264 | LARGE_INTEGER KernelTime; | 265 | LARGE_INTEGER KernelTime; |
265 | LARGE_INTEGER UserTime; | 266 | LARGE_INTEGER UserTime; |
266 | LARGE_INTEGER Reserved1[2]; | 267 | LARGE_INTEGER Reserved1[2]; |
267 | ULONG Reserved2; | 268 | ULONG Reserved2; |
268 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | 269 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; |
269 | 270 | ||
270 | #define sleep(secs) (Sleep(secs * 1000)) | 271 | #define sleep(secs) (Sleep(secs * 1000)) |
271 | 272 | ||
@@ -282,11 +283,11 @@ typedef struct | |||
282 | #define SHUT_RDWR SD_BOTH | 283 | #define SHUT_RDWR SD_BOTH |
283 | 284 | ||
284 | /* Operations for flock() */ | 285 | /* Operations for flock() */ |
285 | #define LOCK_SH 1 /* shared lock */ | 286 | #define LOCK_SH 1 /* shared lock */ |
286 | #define LOCK_EX 2 /* exclusive lock */ | 287 | #define LOCK_EX 2 /* exclusive lock */ |
287 | #define LOCK_NB 4 /* or'd with one of the above to prevent | 288 | #define LOCK_NB 4 /* or'd with one of the above to prevent |
288 | blocking */ | 289 | blocking */ |
289 | #define LOCK_UN 8 /* remove lock */ | 290 | #define LOCK_UN 8 /* remove lock */ |
290 | 291 | ||
291 | /* Not supported under MinGW */ | 292 | /* Not supported under MinGW */ |
292 | #define S_IRGRP 0 | 293 | #define S_IRGRP 0 |
@@ -312,273 +313,274 @@ typedef struct | |||
312 | */ | 313 | */ |
313 | #define index(s, c) strchr(s, c) | 314 | #define index(s, c) strchr(s, c) |
314 | 315 | ||
315 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | 316 | BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest); |
316 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | 317 | BOOL _plibc_DereferenceShortcut (char *pszShortcut); |
317 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | 318 | char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags); |
318 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | 319 | char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags); |
319 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, | 320 | long QueryRegistry (HKEY hMainKey, char *pszKey, char *pszSubKey, |
320 | char *pszBuffer, long *pdLength); | 321 | char *pszBuffer, long *pdLength); |
321 | 322 | ||
322 | BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); | 323 | BOOL __win_IsHandleMarkedAsBlocking (SOCKET hHandle); |
323 | void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); | 324 | void __win_SetHandleBlockingMode (SOCKET s, BOOL bBlocking); |
324 | void __win_DiscardHandleBlockingMode(SOCKET s); | 325 | void __win_DiscardHandleBlockingMode (SOCKET s); |
325 | int _win_isSocketValid(int s); | 326 | int _win_isSocketValid (int s); |
326 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | 327 | int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows); |
327 | 328 | ||
328 | typedef void (*TPanicProc) (int, char *); | 329 | typedef void (*TPanicProc) (int, char *); |
329 | void plibc_set_panic_proc(TPanicProc proc); | 330 | void plibc_set_panic_proc (TPanicProc proc); |
330 | 331 | ||
331 | int flock(int fd, int operation); | 332 | int flock (int fd, int operation); |
332 | int fsync(int fildes); | 333 | int fsync (int fildes); |
333 | int inet_pton(int af, const char *src, void *dst); | 334 | int inet_pton (int af, const char *src, void *dst); |
334 | int inet_pton4(const char *src, u_char *dst, int pton); | 335 | int inet_pton4 (const char *src, u_char * dst, int pton); |
335 | #if USE_IPV6 | 336 | #if USE_IPV6 |
336 | int inet_pton6(const char *src, u_char *dst); | 337 | int inet_pton6 (const char *src, u_char * dst); |
337 | #endif | 338 | #endif |
338 | int truncate(const char *fname, int distance); | 339 | int truncate (const char *fname, int distance); |
339 | int statfs(const char *path, struct statfs *buf); | 340 | int statfs (const char *path, struct statfs *buf); |
340 | const char *hstrerror(int err); | 341 | const char *hstrerror (int err); |
341 | void gettimeofday(struct timeval *tp, void *tzp); | 342 | void gettimeofday (struct timeval *tp, void *tzp); |
342 | int mkstemp(char *tmplate); | 343 | int mkstemp (char *tmplate); |
343 | char *strptime (const char *buf, const char *format, struct tm *tm); | 344 | char *strptime (const char *buf, const char *format, struct tm *tm); |
344 | char *ctime(const time_t *clock); | 345 | char *ctime (const time_t * clock); |
345 | char *ctime_r(const time_t *clock, char *buf); | 346 | char *ctime_r (const time_t * clock, char *buf); |
346 | const char *inet_ntop(int af, const void *src, char *dst, size_t size); | 347 | const char *inet_ntop (int af, const void *src, char *dst, size_t size); |
347 | int plibc_init(char *pszOrg, char *pszApp); | 348 | int plibc_init (char *pszOrg, char *pszApp); |
348 | void plibc_shutdown(); | 349 | void plibc_shutdown (); |
349 | int plibc_initialized(); | 350 | int plibc_initialized (); |
350 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); | 351 | int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows, |
351 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | 352 | int derefLinks); |
352 | void SetErrnoFromWinsockError(long lWinError); | 353 | void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine); |
353 | void SetHErrnoFromWinError(long lWinError); | 354 | void SetErrnoFromWinsockError (long lWinError); |
354 | void SetErrnoFromHRESULT(HRESULT hRes); | 355 | void SetHErrnoFromWinError (long lWinError); |
355 | FILE *_win_fopen(const char *filename, const char *mode); | 356 | void SetErrnoFromHRESULT (HRESULT hRes); |
356 | DIR *_win_opendir(const char *dirname); | 357 | FILE *_win_fopen (const char *filename, const char *mode); |
357 | int _win_open(const char *filename, int oflag, ...); | 358 | DIR *_win_opendir (const char *dirname); |
359 | int _win_open (const char *filename, int oflag, ...); | ||
358 | #ifdef ENABLE_NLS | 360 | #ifdef ENABLE_NLS |
359 | char *_win_bindtextdomain(const char *domainname, const char *dirname); | 361 | char *_win_bindtextdomain (const char *domainname, const char *dirname); |
360 | #endif | 362 | #endif |
361 | int _win_chdir(const char *path); | 363 | int _win_chdir (const char *path); |
362 | int _win_close(int fd); | 364 | int _win_close (int fd); |
363 | int _win_creat(const char *path, mode_t mode); | 365 | int _win_creat (const char *path, mode_t mode); |
364 | int _win_fstat(int handle, struct stat *buffer); | 366 | int _win_fstat (int handle, struct stat *buffer); |
365 | int _win_pipe(int *phandles); | 367 | int _win_pipe (int *phandles); |
366 | int _win_rmdir(const char *path); | 368 | int _win_rmdir (const char *path); |
367 | int _win_access( const char *path, int mode ); | 369 | int _win_access (const char *path, int mode); |
368 | int _win_chmod(const char *filename, int pmode); | 370 | int _win_chmod (const char *filename, int pmode); |
369 | char *realpath(const char *file_name, char *resolved_name); | 371 | char *realpath (const char *file_name, char *resolved_name); |
370 | long _win_random(void); | 372 | long _win_random (void); |
371 | int _win_remove(const char *path); | 373 | int _win_remove (const char *path); |
372 | int _win_rename(const char *oldname, const char *newname); | 374 | int _win_rename (const char *oldname, const char *newname); |
373 | int _win_stat(const char *path, struct stat *buffer); | 375 | int _win_stat (const char *path, struct stat *buffer); |
374 | int _win_stat64(const char *path, struct stat64 *buffer); | 376 | int _win_stat64 (const char *path, struct stat64 *buffer); |
375 | int _win_unlink(const char *filename); | 377 | int _win_unlink (const char *filename); |
376 | int _win_write(int fildes, const void *buf, size_t nbyte); | 378 | int _win_write (int fildes, const void *buf, size_t nbyte); |
377 | int _win_read(int fildes, void *buf, size_t nbyte); | 379 | int _win_read (int fildes, void *buf, size_t nbyte); |
378 | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); | 380 | size_t _win_fwrite (const void *buffer, size_t size, size_t count, |
379 | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | 381 | FILE * stream); |
380 | int _win_symlink(const char *path1, const char *path2); | 382 | size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream); |
381 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | 383 | int _win_symlink (const char *path1, const char *path2); |
382 | unsigned long long offset); | 384 | void *_win_mmap (void *start, size_t len, int access, int flags, int fd, |
383 | int _win_munmap(void *start, size_t length); | 385 | unsigned long long offset); |
384 | int _win_lstat(const char *path, struct stat *buf); | 386 | int _win_munmap (void *start, size_t length); |
385 | int _win_lstat64(const char *path, struct stat64 *buf); | 387 | int _win_lstat (const char *path, struct stat *buf); |
386 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 388 | int _win_lstat64 (const char *path, struct stat64 *buf); |
387 | int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); | 389 | int _win_readlink (const char *path, char *buf, size_t bufsize); |
388 | int _win_printf(const char *format,...); | 390 | int _win_accept (SOCKET s, struct sockaddr *addr, int *addrlen); |
389 | int _win_fprintf(FILE *f,const char *format,...); | 391 | int _win_printf (const char *format, ...); |
390 | int _win_vprintf(const char *format, va_list ap); | 392 | int _win_fprintf (FILE * f, const char *format, ...); |
391 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | 393 | int _win_vprintf (const char *format, va_list ap); |
392 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | 394 | int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr); |
393 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | 395 | int _win_vsprintf (char *dest, const char *format, va_list arg_ptr); |
394 | int _win_snprintf(char *str,size_t size,const char *format,...); | 396 | int _win_vsnprintf (char *str, size_t size, const char *format, |
395 | int _win_sprintf(char *dest,const char *format,...); | 397 | va_list arg_ptr); |
396 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | 398 | int _win_snprintf (char *str, size_t size, const char *format, ...); |
397 | int _win_sscanf(const char *str, const char *format, ...); | 399 | int _win_sprintf (char *dest, const char *format, ...); |
398 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | 400 | int _win_vsscanf (const char *str, const char *format, va_list arg_ptr); |
399 | int _win_vscanf(const char *format, va_list arg_ptr); | 401 | int _win_sscanf (const char *str, const char *format, ...); |
400 | int _win_scanf(const char *format, ...); | 402 | int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr); |
401 | int _win_fscanf(FILE *stream, const char *format, ...); | 403 | int _win_vscanf (const char *format, va_list arg_ptr); |
402 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 404 | int _win_scanf (const char *format, ...); |
403 | int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); | 405 | int _win_fscanf (FILE * stream, const char *format, ...); |
404 | int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); | 406 | pid_t _win_waitpid (pid_t pid, int *stat_loc, int options); |
405 | int _win_getpeername(SOCKET s, struct sockaddr *name, | 407 | int _win_bind (SOCKET s, const struct sockaddr *name, int namelen); |
406 | int *namelen); | 408 | int _win_connect (SOCKET s, const struct sockaddr *name, int namelen); |
407 | int _win_getsockname(SOCKET s, struct sockaddr *name, | 409 | int _win_getpeername (SOCKET s, struct sockaddr *name, int *namelen); |
408 | int *namelen); | 410 | int _win_getsockname (SOCKET s, struct sockaddr *name, int *namelen); |
409 | int _win_getsockopt(SOCKET s, int level, int optname, char *optval, | 411 | int _win_getsockopt (SOCKET s, int level, int optname, char *optval, |
410 | int *optlen); | 412 | int *optlen); |
411 | int _win_listen(SOCKET s, int backlog); | 413 | int _win_listen (SOCKET s, int backlog); |
412 | int _win_recv(SOCKET s, char *buf, int len, int flags); | 414 | int _win_recv (SOCKET s, char *buf, int len, int flags); |
413 | int _win_recvfrom(SOCKET s, void *buf, int len, int flags, | 415 | int _win_recvfrom (SOCKET s, void *buf, int len, int flags, |
414 | struct sockaddr *from, int *fromlen); | 416 | struct sockaddr *from, int *fromlen); |
415 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | 417 | int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, |
416 | const struct timeval *tv); | 418 | const struct timeval *tv); |
417 | int _win_send(SOCKET s, const char *buf, int len, int flags); | 419 | int _win_send (SOCKET s, const char *buf, int len, int flags); |
418 | int _win_sendto(SOCKET s, const char *buf, int len, int flags, | 420 | int _win_sendto (SOCKET s, const char *buf, int len, int flags, |
419 | const struct sockaddr *to, int tolen); | 421 | const struct sockaddr *to, int tolen); |
420 | int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, | 422 | int _win_setsockopt (SOCKET s, int level, int optname, const void *optval, |
421 | int optlen); | 423 | int optlen); |
422 | int _win_shutdown(SOCKET s, int how); | 424 | int _win_shutdown (SOCKET s, int how); |
423 | SOCKET _win_socket(int af, int type, int protocol); | 425 | SOCKET _win_socket (int af, int type, int protocol); |
424 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | 426 | struct hostent *_win_gethostbyaddr (const char *addr, int len, int type); |
425 | struct hostent *_win_gethostbyname(const char *name); | 427 | struct hostent *_win_gethostbyname (const char *name); |
426 | char *_win_strerror(int errnum); | 428 | char *_win_strerror (int errnum); |
427 | int IsWinNT(); | 429 | int IsWinNT (); |
428 | 430 | ||
429 | #if !HAVE_STRNDUP | 431 | #if !HAVE_STRNDUP |
430 | char *strndup (const char *s, size_t n); | 432 | char *strndup (const char *s, size_t n); |
431 | #endif | 433 | #endif |
432 | #if !HAVE_STRNLEN | 434 | #if !HAVE_STRNLEN |
433 | size_t strnlen (const char *str, size_t maxlen); | 435 | size_t strnlen (const char *str, size_t maxlen); |
434 | #endif | 436 | #endif |
435 | 437 | ||
436 | #define strcasecmp(a, b) stricmp(a, b) | 438 | #define strcasecmp(a, b) stricmp(a, b) |
437 | #define strncasecmp(a, b, c) strnicmp(a, b, c) | 439 | #define strncasecmp(a, b, c) strnicmp(a, b, c) |
438 | 440 | ||
439 | #endif /* WINDOWS */ | 441 | #endif /* WINDOWS */ |
440 | 442 | ||
441 | #ifndef WINDOWS | 443 | #ifndef WINDOWS |
442 | #define DIR_SEPARATOR '/' | 444 | #define DIR_SEPARATOR '/' |
443 | #define DIR_SEPARATOR_STR "/" | 445 | #define DIR_SEPARATOR_STR "/" |
444 | #define PATH_SEPARATOR ';' | 446 | #define PATH_SEPARATOR ';' |
445 | #define PATH_SEPARATOR_STR ";" | 447 | #define PATH_SEPARATOR_STR ";" |
446 | #define NEWLINE "\n" | 448 | #define NEWLINE "\n" |
447 | 449 | ||
448 | #ifdef ENABLE_NLS | 450 | #ifdef ENABLE_NLS |
449 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | 451 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) |
450 | #endif | 452 | #endif |
451 | #define CREAT(p, m) creat(p, m) | 453 | #define CREAT(p, m) creat(p, m) |
452 | #undef FOPEN | 454 | #undef FOPEN |
453 | #define FOPEN(f, m) fopen(f, m) | 455 | #define FOPEN(f, m) fopen(f, m) |
454 | #define OPENDIR(d) opendir(d) | 456 | #define OPENDIR(d) opendir(d) |
455 | #define OPEN(f) open(f) | 457 | #define OPEN(f) open(f) |
456 | #define CHDIR(d) chdir(d) | 458 | #define CHDIR(d) chdir(d) |
457 | #define CLOSE(f) close(f) | 459 | #define CLOSE(f) close(f) |
458 | #define RMDIR(f) rmdir(f) | 460 | #define RMDIR(f) rmdir(f) |
459 | #define ACCESS(p, m) access(p, m) | 461 | #define ACCESS(p, m) access(p, m) |
460 | #define CHMOD(f, p) chmod(f, p) | 462 | #define CHMOD(f, p) chmod(f, p) |
461 | #define FSTAT(h, b) fstat(h, b) | 463 | #define FSTAT(h, b) fstat(h, b) |
462 | #define PIPE(h) pipe(h) | 464 | #define PIPE(h) pipe(h) |
463 | #define REMOVE(p) remove(p) | 465 | #define REMOVE(p) remove(p) |
464 | #define RENAME(o, n) rename(o, n) | 466 | #define RENAME(o, n) rename(o, n) |
465 | #define STAT(p, b) stat(p, b) | 467 | #define STAT(p, b) stat(p, b) |
466 | #define STAT64(p, b) stat64(p, b) | 468 | #define STAT64(p, b) stat64(p, b) |
467 | #define UNLINK(f) unlink(f) | 469 | #define UNLINK(f) unlink(f) |
468 | #define WRITE(f, b, n) write(f, b, n) | 470 | #define WRITE(f, b, n) write(f, b, n) |
469 | #define READ(f, b, n) read(f, b, n) | 471 | #define READ(f, b, n) read(f, b, n) |
470 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) | 472 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) |
471 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | 473 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) |
472 | #define SYMLINK(a, b) symlink(a, b) | 474 | #define SYMLINK(a, b) symlink(a, b) |
473 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | 475 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) |
474 | #define MUNMAP(s, l) munmap(s, l) | 476 | #define MUNMAP(s, l) munmap(s, l) |
475 | #define STRERROR(i) strerror(i) | 477 | #define STRERROR(i) strerror(i) |
476 | #define RANDOM() random() | 478 | #define RANDOM() random() |
477 | #define READLINK(p, b, s) readlink(p, b, s) | 479 | #define READLINK(p, b, s) readlink(p, b, s) |
478 | #define LSTAT(p, b) lstat(p, b) | 480 | #define LSTAT(p, b) lstat(p, b) |
479 | #define LSTAT64(p, b) lstat64(p, b) | 481 | #define LSTAT64(p, b) lstat64(p, b) |
480 | #define PRINTF printf | 482 | #define PRINTF printf |
481 | #define FPRINTF fprintf | 483 | #define FPRINTF fprintf |
482 | #define VPRINTF(f, a) vprintf(f, a) | 484 | #define VPRINTF(f, a) vprintf(f, a) |
483 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) | 485 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) |
484 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) | 486 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) |
485 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | 487 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) |
486 | #define _REAL_SNPRINTF snprintf | 488 | #define _REAL_SNPRINTF snprintf |
487 | #define SPRINTF sprintf | 489 | #define SPRINTF sprintf |
488 | #define VSSCANF(s, f, a) vsscanf(s, f, a) | 490 | #define VSSCANF(s, f, a) vsscanf(s, f, a) |
489 | #define SSCANF sscanf | 491 | #define SSCANF sscanf |
490 | #define VFSCANF(s, f, a) vfscanf(s, f, a) | 492 | #define VFSCANF(s, f, a) vfscanf(s, f, a) |
491 | #define VSCANF(f, a) vscanf(f, a) | 493 | #define VSCANF(f, a) vscanf(f, a) |
492 | #define SCANF scanf | 494 | #define SCANF scanf |
493 | #define FSCANF fscanf | 495 | #define FSCANF fscanf |
494 | #define WAITPID(p, s, o) waitpid(p, s, o) | 496 | #define WAITPID(p, s, o) waitpid(p, s, o) |
495 | #define ACCEPT(s, a, l) accept(s, a, l) | 497 | #define ACCEPT(s, a, l) accept(s, a, l) |
496 | #define BIND(s, n, l) bind(s, n, l) | 498 | #define BIND(s, n, l) bind(s, n, l) |
497 | #define CONNECT(s, n, l) connect(s, n, l) | 499 | #define CONNECT(s, n, l) connect(s, n, l) |
498 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) | 500 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) |
499 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) | 501 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) |
500 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | 502 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) |
501 | #define LISTEN(s, b) listen(s, b) | 503 | #define LISTEN(s, b) listen(s, b) |
502 | #define RECV(s, b, l, f) recv(s, b, l, f) | 504 | #define RECV(s, b, l, f) recv(s, b, l, f) |
503 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | 505 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) |
504 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) | 506 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) |
505 | #define SEND(s, b, l, f) send(s, b, l, f) | 507 | #define SEND(s, b, l, f) send(s, b, l, f) |
506 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | 508 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) |
507 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | 509 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) |
508 | #define SHUTDOWN(s, h) shutdown(s, h) | 510 | #define SHUTDOWN(s, h) shutdown(s, h) |
509 | #define SOCKET(a, t, p) socket(a, t, p) | 511 | #define SOCKET(a, t, p) socket(a, t, p) |
510 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | 512 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) |
511 | #define GETHOSTBYNAME(n) gethostbyname(n) | 513 | #define GETHOSTBYNAME(n) gethostbyname(n) |
512 | #else | 514 | #else |
513 | #define DIR_SEPARATOR '\\' | 515 | #define DIR_SEPARATOR '\\' |
514 | #define DIR_SEPARATOR_STR "\\" | 516 | #define DIR_SEPARATOR_STR "\\" |
515 | #define PATH_SEPARATOR ':' | 517 | #define PATH_SEPARATOR ':' |
516 | #define PATH_SEPARATOR_STR ":" | 518 | #define PATH_SEPARATOR_STR ":" |
517 | #define NEWLINE "\r\n" | 519 | #define NEWLINE "\r\n" |
518 | 520 | ||
519 | #ifdef ENABLE_NLS | 521 | #ifdef ENABLE_NLS |
520 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | 522 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) |
521 | #endif | 523 | #endif |
522 | #define CREAT(p, m) _win_creat(p, m) | 524 | #define CREAT(p, m) _win_creat(p, m) |
523 | #define FOPEN(f, m) _win_fopen(f, m) | 525 | #define FOPEN(f, m) _win_fopen(f, m) |
524 | #define OPENDIR(d) _win_opendir(d) | 526 | #define OPENDIR(d) _win_opendir(d) |
525 | #define OPEN(f) _win_open(f) | 527 | #define OPEN(f) _win_open(f) |
526 | #define CHDIR(d) _win_chdir(d) | 528 | #define CHDIR(d) _win_chdir(d) |
527 | #define CLOSE(f) _win_close(f) | 529 | #define CLOSE(f) _win_close(f) |
528 | #define FSTAT(h, b) _win_fstat(h, b) | 530 | #define FSTAT(h, b) _win_fstat(h, b) |
529 | #define RMDIR(f) _win_rmdir(f) | 531 | #define RMDIR(f) _win_rmdir(f) |
530 | #define ACCESS(p, m) _win_access(p, m) | 532 | #define ACCESS(p, m) _win_access(p, m) |
531 | #define CHMOD(f, p) _win_chmod(f, p) | 533 | #define CHMOD(f, p) _win_chmod(f, p) |
532 | #define PIPE(h) _win_pipe(h) | 534 | #define PIPE(h) _win_pipe(h) |
533 | #define RANDOM() _win_random() | 535 | #define RANDOM() _win_random() |
534 | #define REMOVE(p) _win_remove(p) | 536 | #define REMOVE(p) _win_remove(p) |
535 | #define RENAME(o, n) _win_rename(o, n) | 537 | #define RENAME(o, n) _win_rename(o, n) |
536 | #define STAT(p, b) _win_stat(p, b) | 538 | #define STAT(p, b) _win_stat(p, b) |
537 | #define STAT64(p, b) _win_stat64(p, b) | 539 | #define STAT64(p, b) _win_stat64(p, b) |
538 | #define UNLINK(f) _win_unlink(f) | 540 | #define UNLINK(f) _win_unlink(f) |
539 | #define WRITE(f, b, n) _win_write(f, b, n) | 541 | #define WRITE(f, b, n) _win_write(f, b, n) |
540 | #define READ(f, b, n) _win_read(f, b, n) | 542 | #define READ(f, b, n) _win_read(f, b, n) |
541 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | 543 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) |
542 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | 544 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) |
543 | #define SYMLINK(a, b) _win_symlink(a, b) | 545 | #define SYMLINK(a, b) _win_symlink(a, b) |
544 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | 546 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) |
545 | #define MUNMAP(s, l) _win_munmap(s, l) | 547 | #define MUNMAP(s, l) _win_munmap(s, l) |
546 | #define STRERROR(i) _win_strerror(i) | 548 | #define STRERROR(i) _win_strerror(i) |
547 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 549 | #define READLINK(p, b, s) _win_readlink(p, b, s) |
548 | #define LSTAT(p, b) _win_lstat(p, b) | 550 | #define LSTAT(p, b) _win_lstat(p, b) |
549 | #define LSTAT64(p, b) _win_lstat64(p, b) | 551 | #define LSTAT64(p, b) _win_lstat64(p, b) |
550 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | 552 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) |
551 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | 553 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) |
552 | #define VPRINTF(f, a) _win_vprintf(f, a) | 554 | #define VPRINTF(f, a) _win_vprintf(f, a) |
553 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | 555 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) |
554 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | 556 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) |
555 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | 557 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) |
556 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | 558 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) |
557 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | 559 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) |
558 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | 560 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) |
559 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | 561 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) |
560 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | 562 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) |
561 | #define VSCANF(f, a) _win_vscanf(f, a) | 563 | #define VSCANF(f, a) _win_vscanf(f, a) |
562 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | 564 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) |
563 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | 565 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) |
564 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | 566 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) |
565 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | 567 | #define ACCEPT(s, a, l) _win_accept(s, a, l) |
566 | #define BIND(s, n, l) _win_bind(s, n, l) | 568 | #define BIND(s, n, l) _win_bind(s, n, l) |
567 | #define CONNECT(s, n, l) _win_connect(s, n, l) | 569 | #define CONNECT(s, n, l) _win_connect(s, n, l) |
568 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | 570 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) |
569 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | 571 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) |
570 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | 572 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) |
571 | #define LISTEN(s, b) _win_listen(s, b) | 573 | #define LISTEN(s, b) _win_listen(s, b) |
572 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) | 574 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) |
573 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | 575 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) |
574 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | 576 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) |
575 | #define SEND(s, b, l, f) _win_send(s, b, l, f) | 577 | #define SEND(s, b, l, f) _win_send(s, b, l, f) |
576 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | 578 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) |
577 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | 579 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) |
578 | #define SHUTDOWN(s, h) _win_shutdown(s, h) | 580 | #define SHUTDOWN(s, h) _win_shutdown(s, h) |
579 | #define SOCKET(a, t, p) _win_socket(a, t, p) | 581 | #define SOCKET(a, t, p) _win_socket(a, t, p) |
580 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | 582 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) |
581 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | 583 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) |
582 | #endif | 584 | #endif |
583 | 585 | ||
584 | 586 | ||
@@ -587,6 +589,6 @@ size_t strnlen (const char *str, size_t maxlen); | |||
587 | #endif | 589 | #endif |
588 | 590 | ||
589 | 591 | ||
590 | #endif //_PLIBC_H_ | 592 | #endif //_PLIBC_H_ |
591 | 593 | ||
592 | /* end of plibc.h */ | 594 | /* end of plibc.h */ |
diff --git a/src/daemon/response.c b/src/daemon/response.c index 3adb6bc9..56333396 100644 --- a/src/daemon/response.c +++ b/src/daemon/response.c | |||
@@ -160,21 +160,20 @@ MHD_get_response_header (struct MHD_Response *response, const char *key) | |||
160 | */ | 160 | */ |
161 | struct MHD_Response * | 161 | struct MHD_Response * |
162 | MHD_create_response_from_callback (size_t size, | 162 | MHD_create_response_from_callback (size_t size, |
163 | unsigned int block_size, | 163 | unsigned int block_size, |
164 | MHD_ContentReaderCallback crc, | 164 | MHD_ContentReaderCallback crc, |
165 | void *crc_cls, | 165 | void *crc_cls, |
166 | MHD_ContentReaderFreeCallback crfc) | 166 | MHD_ContentReaderFreeCallback crfc) |
167 | { | 167 | { |
168 | struct MHD_Response *retVal; | 168 | struct MHD_Response *retVal; |
169 | 169 | ||
170 | if ( (crc == NULL) || | 170 | if ((crc == NULL) || (block_size == 0)) |
171 | (block_size == 0) ) | ||
172 | return NULL; | 171 | return NULL; |
173 | retVal = malloc (sizeof (struct MHD_Response) + block_size); | 172 | retVal = malloc (sizeof (struct MHD_Response) + block_size); |
174 | if (retVal == NULL) | 173 | if (retVal == NULL) |
175 | return NULL; | 174 | return NULL; |
176 | memset (retVal, 0, sizeof (struct MHD_Response)); | 175 | memset (retVal, 0, sizeof (struct MHD_Response)); |
177 | retVal->data = (void*) &retVal[1]; | 176 | retVal->data = (void *) &retVal[1]; |
178 | retVal->data_buffer_size = MHD_BUF_INC_SIZE; | 177 | retVal->data_buffer_size = MHD_BUF_INC_SIZE; |
179 | if (pthread_mutex_init (&retVal->mutex, NULL) != 0) | 178 | if (pthread_mutex_init (&retVal->mutex, NULL) != 0) |
180 | { | 179 | { |
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index ec08318d..621ce705 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -27,7 +27,7 @@ | |||
27 | * All symbols defined in this header start with MHD. MHD is a | 27 | * All symbols defined in this header start with MHD. MHD is a |
28 | * micro-httpd library. As such, it does not have any API for logging | 28 | * micro-httpd library. As such, it does not have any API for logging |
29 | * errors. Also, it may not support all of the HTTP features directly, | 29 | * errors. Also, it may not support all of the HTTP features directly, |
30 | * where applicable, portions of HTTP may have to be handled by | 30 | * where applicable, portions of HTTP may have to be handled by |
31 | * clients of the library (the library is supposed to handle | 31 | * clients of the library (the library is supposed to handle |
32 | * everything that it must handle, such as basic connection | 32 | * everything that it must handle, such as basic connection |
33 | * management; however, detailed interpretations of headers | 33 | * management; however, detailed interpretations of headers |
@@ -255,7 +255,7 @@ enum MHD_FLAG | |||
255 | }; | 255 | }; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * MHD options. Passed in the varargs portion | 258 | * MHD options. Passed in the varargs portion |
259 | * of MHD_start_daemon. | 259 | * of MHD_start_daemon. |
260 | */ | 260 | */ |
261 | enum MHD_OPTION | 261 | enum MHD_OPTION |
@@ -280,7 +280,7 @@ enum MHD_OPTION | |||
280 | MHD_OPTION_CONNECTION_LIMIT = 2, | 280 | MHD_OPTION_CONNECTION_LIMIT = 2, |
281 | 281 | ||
282 | /** | 282 | /** |
283 | * After how many seconds of inactivity should a | 283 | * After how many seconds of inactivity should a |
284 | * connection automatically be timed out? (followed | 284 | * connection automatically be timed out? (followed |
285 | * by an unsigned int; use zero for no timeout). | 285 | * by an unsigned int; use zero for no timeout). |
286 | */ | 286 | */ |
@@ -371,7 +371,7 @@ typedef int | |||
371 | * @param upload_data the data being uploaded (excluding HEADERS, | 371 | * @param upload_data the data being uploaded (excluding HEADERS, |
372 | * for a POST that fits into memory and that is encoded | 372 | * for a POST that fits into memory and that is encoded |
373 | * with a supported encoding, the POST data will NOT be | 373 | * with a supported encoding, the POST data will NOT be |
374 | * given in upload_data and is instead available as | 374 | * given in upload_data and is instead available as |
375 | * part of MHD_get_connection_values; very large POST | 375 | * part of MHD_get_connection_values; very large POST |
376 | * data *will* be made available incrementally in | 376 | * data *will* be made available incrementally in |
377 | * upload_data) | 377 | * upload_data) |
@@ -490,15 +490,13 @@ MHD_get_fdset (struct MHD_Daemon *daemon, | |||
490 | * (only needed if connection timeout is used). The | 490 | * (only needed if connection timeout is used). The |
491 | * returned value is how long select should at most | 491 | * returned value is how long select should at most |
492 | * block, not the timeout value set for connections. | 492 | * block, not the timeout value set for connections. |
493 | * | 493 | * |
494 | * @param timeout set to the timeout (in milliseconds) | 494 | * @param timeout set to the timeout (in milliseconds) |
495 | * @return MHD_YES on success, MHD_NO if timeouts are | 495 | * @return MHD_YES on success, MHD_NO if timeouts are |
496 | * not used (or no connections exist that would | 496 | * not used (or no connections exist that would |
497 | * necessiate the use of a timeout right now). | 497 | * necessiate the use of a timeout right now). |
498 | */ | 498 | */ |
499 | int | 499 | int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout); |
500 | MHD_get_timeout(struct MHD_Daemon * daemon, | ||
501 | unsigned long long * timeout); | ||
502 | 500 | ||
503 | 501 | ||
504 | /** | 502 | /** |
@@ -594,7 +592,8 @@ MHD_queue_response (struct MHD_Connection *connection, | |||
594 | * @return NULL on error (i.e. invalid arguments, out of memory) | 592 | * @return NULL on error (i.e. invalid arguments, out of memory) |
595 | */ | 593 | */ |
596 | struct MHD_Response *MHD_create_response_from_callback (size_t size, | 594 | struct MHD_Response *MHD_create_response_from_callback (size_t size, |
597 | unsigned int block_size, | 595 | unsigned int |
596 | block_size, | ||
598 | MHD_ContentReaderCallback | 597 | MHD_ContentReaderCallback |
599 | crc, void *crc_cls, | 598 | crc, void *crc_cls, |
600 | MHD_ContentReaderFreeCallback | 599 | MHD_ContentReaderFreeCallback |