diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-17 19:33:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-17 19:33:20 +0000 |
commit | 017c372418745036838314c0bf6cefba1773d3d9 (patch) | |
tree | 7aa4c478d79a9edef8365f1256336b384d7f1099 | |
parent | a2425da6f9ba532d8a82906cdbb9ea6076d6a091 (diff) | |
download | libmicrohttpd-017c372418745036838314c0bf6cefba1773d3d9.tar.gz libmicrohttpd-017c372418745036838314c0bf6cefba1773d3d9.zip |
also pass MHD connection handle in URI callback, needed for GNUnet
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | doc/libmicrohttpd.texi | 6 | ||||
-rw-r--r-- | src/include/microhttpd.h | 9 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 3 | ||||
-rw-r--r-- | src/microhttpd/internal.h | 5 |
5 files changed, 21 insertions, 5 deletions
@@ -1,3 +1,6 @@ | |||
1 | Tue Sep 17 21:32:47 CEST 2013 | ||
2 | Also pass MHD connection handle in URI log callback. -CG | ||
3 | |||
1 | Fri Sep 6 10:00:44 CEST 2013 | 4 | Fri Sep 6 10:00:44 CEST 2013 |
2 | Improved check for proper OpenSSL version for | 5 | Improved check for proper OpenSSL version for |
3 | libmicrospdy. -CG | 6 | libmicrospdy. -CG |
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi index 6a4a1cf5..3ff8c2ac 100644 --- a/doc/libmicrohttpd.texi +++ b/doc/libmicrohttpd.texi | |||
@@ -631,7 +631,7 @@ parsing will no longer contain the options, which maybe inconvenient for | |||
631 | logging. This option should be followed by two arguments, the first | 631 | logging. This option should be followed by two arguments, the first |
632 | one must be of the form | 632 | one must be of the form |
633 | @example | 633 | @example |
634 | void * my_logger(void * cls, const char * uri) | 634 | void * my_logger(void * cls, const char * uri, struct MHD_Connection *con) |
635 | @end example | 635 | @end example |
636 | where the return value will be passed as | 636 | where the return value will be passed as |
637 | @code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback} | 637 | @code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback} |
@@ -644,6 +644,10 @@ rely on the first call to the access handler having | |||
644 | MHD_OPTION_URI_LOG_CALLBACK. Finally, @code{uri} will | 644 | MHD_OPTION_URI_LOG_CALLBACK. Finally, @code{uri} will |
645 | be the 0-terminated URI of the request. | 645 | be the 0-terminated URI of the request. |
646 | 646 | ||
647 | Note that during the time of this call, most of the connection's state | ||
648 | is not initialized (as we have not yet parsed he headers). However, | ||
649 | information about the connecting client (IP, socket) is available. | ||
650 | |||
647 | @item MHD_OPTION_HTTPS_MEM_KEY | 651 | @item MHD_OPTION_HTTPS_MEM_KEY |
648 | @cindex SSL | 652 | @cindex SSL |
649 | @cindex TLS | 653 | @cindex TLS |
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 84d1cacf..9d9af65d 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -121,7 +121,7 @@ extern "C" | |||
121 | * Current version of the library. | 121 | * Current version of the library. |
122 | * 0x01093001 = 1.9.30-1. | 122 | * 0x01093001 = 1.9.30-1. |
123 | */ | 123 | */ |
124 | #define MHD_VERSION 0x00093000 | 124 | #define MHD_VERSION 0x00093001 |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * MHD-internal return code for "YES". | 127 | * MHD-internal return code for "YES". |
@@ -611,7 +611,7 @@ enum MHD_OPTION | |||
611 | * logging. This option should be followed by two arguments, the first | 611 | * logging. This option should be followed by two arguments, the first |
612 | * one must be of the form | 612 | * one must be of the form |
613 | * | 613 | * |
614 | * void * my_logger(void *cls, const char *uri) | 614 | * void * my_logger(void *cls, const char *uri, struct MHD_Connection *con) |
615 | * | 615 | * |
616 | * where the return value will be passed as | 616 | * where the return value will be passed as |
617 | * (`* con_cls`) in calls to the #MHD_AccessHandlerCallback | 617 | * (`* con_cls`) in calls to the #MHD_AccessHandlerCallback |
@@ -623,6 +623,11 @@ enum MHD_OPTION | |||
623 | * "cls" will be set to the second argument following | 623 | * "cls" will be set to the second argument following |
624 | * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will | 624 | * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will |
625 | * be the 0-terminated URI of the request. | 625 | * be the 0-terminated URI of the request. |
626 | * | ||
627 | * Note that during the time of this call, most of the connection's | ||
628 | * state is not initialized (as we have not yet parsed he headers). | ||
629 | * However, information about the connecting client (IP, socket) | ||
630 | * is available. | ||
626 | */ | 631 | */ |
627 | MHD_OPTION_URI_LOG_CALLBACK = 7, | 632 | MHD_OPTION_URI_LOG_CALLBACK = 7, |
628 | 633 | ||
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 8f94ebd7..611ff12f 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -1255,7 +1255,8 @@ parse_initial_message_line (struct MHD_Connection *connection, char *line) | |||
1255 | if (NULL != connection->daemon->uri_log_callback) | 1255 | if (NULL != connection->daemon->uri_log_callback) |
1256 | connection->client_context | 1256 | connection->client_context |
1257 | = connection->daemon->uri_log_callback (connection->daemon->uri_log_callback_cls, | 1257 | = connection->daemon->uri_log_callback (connection->daemon->uri_log_callback_cls, |
1258 | uri); | 1258 | uri, |
1259 | connection); | ||
1259 | args = strchr (uri, '?'); | 1260 | args = strchr (uri, '?'); |
1260 | if (NULL != args) | 1261 | if (NULL != args) |
1261 | { | 1262 | { |
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 5089b896..b540a1fc 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -838,9 +838,12 @@ struct MHD_Connection | |||
838 | * | 838 | * |
839 | * @param cls closure | 839 | * @param cls closure |
840 | * @param uri uri being accessed | 840 | * @param uri uri being accessed |
841 | * @param con connection handle | ||
841 | * @return new closure | 842 | * @return new closure |
842 | */ | 843 | */ |
843 | typedef void * (*LogCallback)(void * cls, const char * uri); | 844 | typedef void * (*LogCallback)(void * cls, |
845 | const char * uri, | ||
846 | struct MHD_Connection *con); | ||
844 | 847 | ||
845 | /** | 848 | /** |
846 | * Signature of function called to unescape URIs. See also | 849 | * Signature of function called to unescape URIs. See also |