[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34713 - in libmicrohttpd: . doc src/include src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34713 - in libmicrohttpd: . doc src/include src/microhttpd |
Date: |
Sat, 20 Dec 2014 00:38:18 +0100 |
Author: grothoff
Date: 2014-12-20 00:38:18 +0100 (Sat, 20 Dec 2014)
New Revision: 34713
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/doc/libmicrohttpd.texi
libmicrohttpd/src/include/microhttpd.h
libmicrohttpd/src/microhttpd/daemon.c
libmicrohttpd/src/microhttpd/internal.c
libmicrohttpd/src/microhttpd/internal.h
libmicrohttpd/src/microhttpd/postprocessor.c
Log:
make MHD_http_unescape() part of API (#3585)
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2014-12-19 23:17:14 UTC (rev 34712)
+++ libmicrohttpd/ChangeLog 2014-12-19 23:38:18 UTC (rev 34713)
@@ -1,3 +1,8 @@
+Sat Dec 20 00:35:40 CET 2014
+ Adding MHD_http_unescape() to public API (#3585). -CG
+ Updating documentation to document
+ MHD_is_feature_supported(). -CG
+
Thu Dec 4 00:43:10 CET 2014
If "Connection: upgrade" is requested, do not add
"Connection: Keep-Alive" in the response. -GJ
Modified: libmicrohttpd/doc/libmicrohttpd.texi
===================================================================
--- libmicrohttpd/doc/libmicrohttpd.texi 2014-12-19 23:17:14 UTC (rev
34712)
+++ libmicrohttpd/doc/libmicrohttpd.texi 2014-12-19 23:38:18 UTC (rev
34713)
@@ -65,6 +65,7 @@
* microhttpd-dauth:: Utilizing Authentication.
* microhttpd-post:: Adding a @code{POST} processor.
* microhttpd-info:: Obtaining and modifying status information.
+* microhttpd-util:: Utilities.
Appendices
@@ -2575,9 +2576,141 @@
@end deftp
+
@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
address@hidden ------------------------------------------------------------
address@hidden microhttpd-util
address@hidden Utility functions.
+
address@hidden
+* microhttpd-util feature:: Test supported MHD features
+* microhttpd-util unescape:: Unescape strings
address@hidden menu
+
+
address@hidden ------------------------------------------------------------
address@hidden microhttpd-util feature
address@hidden Testing for supported MHD features
+
+
address@hidden {Enumeration} MHD_FEATURE
+Values of this enum are used to specify what
+information about a daemon is desired.
address@hidden @code
address@hidden MHD_FEATURE_MESSAGES
+Get whether messages are supported. If supported then in debug
+mode messages can be printed to stderr or to external logger.
+
address@hidden MHD_FEATURE_SSL
+Get whether HTTPS is supported. If supported then flag
+MHD_USE_SSL and options MHD_OPTION_HTTPS_MEM_KEY,
+MHD_OPTION_HTTPS_MEM_CERT, MHD_OPTION_HTTPS_MEM_TRUST,
+MHD_OPTION_HTTPS_MEM_DHPARAMS, MHD_OPTION_HTTPS_CRED_TYPE,
+MHD_OPTION_HTTPS_PRIORITIES can be used.
+
address@hidden MHD_FEATURE_HTTPS_CERT_CALLBACK
+Get whether option #MHD_OPTION_HTTPS_CERT_CALLBACK is
+supported.
+
address@hidden MHD_FEATURE_IPv6
+Get whether IPv6 is supported. If supported then flag
+MHD_USE_IPv6 can be used.
+
address@hidden MHD_FEATURE_IPv6_ONLY
+Get whether IPv6 without IPv4 is supported. If not supported
+then IPv4 is always enabled in IPv6 sockets and
+flag MHD_USE_DUAL_STACK if always used when MHD_USE_IPv6 is
+specified.
+
address@hidden MHD_FEATURE_POLL
+Get whether @code{poll()} is supported. If supported then flag
+MHD_USE_POLL can be used.
+
address@hidden MHD_FEATURE_EPOLL
+Get whether @code{epoll()} is supported. If supported then Flags
+MHD_USE_EPOLL_LINUX_ONLY and
+MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used.
+
address@hidden MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET
+Get whether shutdown on listen socket to signal other
+threads is supported. If not supported flag
+MHD_USE_PIPE_FOR_SHUTDOWN is automatically forced.
+
address@hidden MHD_FEATURE_SOCKETPAIR
+Get whether a @code{socketpair()} is used internally instead of
+a @code{pipe()} to signal other threads.
+
address@hidden MHD_FEATURE_TCP_FASTOPEN
+Get whether TCP Fast Open is supported. If supported then
+flag MHD_USE_TCP_FASTOPEN and option
+MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE can be used.
+
address@hidden MHD_FEATURE_BASIC_AUTH
+Get whether HTTP Basic authorization is supported. If supported
+then functions @code{MHD_basic_auth_get_username_password()} and
address@hidden()} can be used.
+
address@hidden MHD_FEATURE_DIGEST_AUTH
+Get whether HTTP Digest authorization is supported. If
+supported then options MHD_OPTION_DIGEST_AUTH_RANDOM,
+MHD_OPTION_NONCE_NC_SIZE and functions @code{MHD_digest_auth_check()},
+can be used.
+
address@hidden MHD_FEATURE_POSTPROCESSOR
+Get whether postprocessor is supported. If supported then
+functions @code{MHD_create_post_processor()},
address@hidden()}, @code{MHD_destroy_post_processor()}
+can be used.
+
address@hidden table
address@hidden deftp
+
+
+
address@hidden {int} MHD_is_feature_supported (enum MHD_FEATURE feature)
+Get information about supported MHD features. Indicate that MHD was
+compiled with or without support for particular feature. Some features
+require additional support by the kernel. However, kernel support is not
+checked by this function.
+
address@hidden @var
address@hidden feature
+type of requested information
address@hidden table
+
+Returns @code{MHD_YES} if the feature is supported,
+and @code{MHD_NO} if not.
address@hidden deftypefun
+
+
address@hidden ------------------------------------------------------------
address@hidden microhttpd-util unescape
address@hidden Unescape strings
+
address@hidden {size_t} MHD_http_unescape (char *val)
+Process escape sequences ('%HH') Updates val in place; the result
+should be UTF-8 encoded and cannot be larger than the input. The
+result must also still be 0-terminated.
+
address@hidden @var
address@hidden val
+value to unescape (modified in the process), must be
+a 0-terminated UTF-8 string.
address@hidden table
+
+Returns length of the resulting val (@code{strlen(val)} may be
+shorter afterwards due to elimination of escape sequences).
+
address@hidden deftypefun
+
+
+
+
address@hidden ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
@c **********************************************************
@c ******************* Appendices *************************
@c **********************************************************
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2014-12-19 23:17:14 UTC (rev
34712)
+++ libmicrohttpd/src/include/microhttpd.h 2014-12-19 23:38:18 UTC (rev
34713)
@@ -1686,6 +1686,19 @@
/**
+ * Process escape sequences ('%HH') Updates val in place; the
+ * result should be UTF-8 encoded and cannot be larger than the input.
+ * The result must also still be 0-terminated.
+ *
+ * @param val value to unescape (modified in the process)
+ * @return length of the resulting val (`strlen(val)` may be
+ * shorter afterwards due to elimination of escape sequences)
+ */
+_MHD_EXTERN size_t
+MHD_http_unescape (char *val);
+
+
+/**
* Get a particular header value. If multiple
* values match the kind, return any one of them.
*
@@ -2439,9 +2452,9 @@
/**
-* Types of information about MHD features,
-* used by #MHD_is_feature_supported.
-*/
+ * Types of information about MHD features,
+ * used by #MHD_is_feature_supported().
+ */
enum MHD_FEATURE
{
/**
@@ -2495,7 +2508,7 @@
/**
* Get whether shutdown on listen socket to signal other
* threads is supported. If not supported flag
- * MHD_USE_PIPE_FOR_SHUTDOWN is automatically forced.
+ * #MHD_USE_PIPE_FOR_SHUTDOWN is automatically forced.
*/
MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET = 8,
@@ -2522,15 +2535,15 @@
/**
* Get whether HTTP Digest authorization is supported. If
* supported then options #MHD_OPTION_DIGEST_AUTH_RANDOM,
- * #MHD_OPTION_NONCE_NC_SIZE and functions #MHD_digest_auth_check,
- * #MHD_digest_auth_check can be used.
+ * #MHD_OPTION_NONCE_NC_SIZE and
+ * #MHD_digest_auth_check() can be used.
*/
MHD_FEATURE_DIGEST_AUTH = 12,
/**
* Get whether postprocessor is supported. If supported then
- * functions #MHD_create_post_processor, #MHD_post_process,
- * #MHD_destroy_post_processor, #MHD_destroy_post_processor can
+ * functions #MHD_create_post_processor(), #MHD_post_process() and
+ * #MHD_destroy_post_processor() can
* be used.
*/
MHD_FEATURE_POSTPROCESSOR = 13
Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c 2014-12-19 23:17:14 UTC (rev
34712)
+++ libmicrohttpd/src/microhttpd/daemon.c 2014-12-19 23:38:18 UTC (rev
34713)
@@ -2743,6 +2743,26 @@
/**
+ * Process escape sequences ('%HH') Updates val in place; the
+ * result should be UTF-8 encoded and cannot be larger than the input.
+ * The result must also still be 0-terminated.
+ *
+ * @param cls closure (use NULL)
+ * @param connection handle to connection, not used
+ * @param val value to unescape (modified in the process)
+ * @return length of the resulting val (strlen(val) maybe
+ * shorter afterwards due to elimination of escape sequences)
+ */
+static size_t
+unescape_wrapper (void *cls,
+ struct MHD_Connection *connection,
+ char *val)
+{
+ return MHD_http_unescape (val);
+}
+
+
+/**
* Start a webserver on the given port. Variadic version of
* #MHD_start_daemon_va.
*
@@ -3410,7 +3430,7 @@
daemon->connection_limit = MHD_MAX_CONNECTIONS_DEFAULT;
daemon->pool_size = MHD_POOL_SIZE_DEFAULT;
daemon->pool_increment = MHD_BUF_INC_SIZE;
- daemon->unescape_callback = &MHD_http_unescape;
+ daemon->unescape_callback = &unescape_wrapper;
daemon->connection_timeout = 0; /* no timeout */
daemon->wpipe[0] = MHD_INVALID_PIPE_;
daemon->wpipe[1] = MHD_INVALID_PIPE_;
Modified: libmicrohttpd/src/microhttpd/internal.c
===================================================================
--- libmicrohttpd/src/microhttpd/internal.c 2014-12-19 23:17:14 UTC (rev
34712)
+++ libmicrohttpd/src/microhttpd/internal.c 2014-12-19 23:38:18 UTC (rev
34713)
@@ -124,16 +124,12 @@
* result should be UTF-8 encoded and cannot be larger than the input.
* The result must also still be 0-terminated.
*
- * @param cls closure (use NULL)
- * @param connection handle to connection, not used
* @param val value to unescape (modified in the process)
* @return length of the resulting val (strlen(val) maybe
* shorter afterwards due to elimination of escape sequences)
*/
size_t
-MHD_http_unescape (void *cls,
- struct MHD_Connection *connection,
- char *val)
+MHD_http_unescape (char *val)
{
char *rpos = val;
char *wpos = val;
Modified: libmicrohttpd/src/microhttpd/internal.h
===================================================================
--- libmicrohttpd/src/microhttpd/internal.h 2014-12-19 23:17:14 UTC (rev
34712)
+++ libmicrohttpd/src/microhttpd/internal.h 2014-12-19 23:38:18 UTC (rev
34713)
@@ -199,23 +199,7 @@
const char *format, ...);
#endif
-/**
- * Process escape sequences ('+'=space, %HH) Updates val in place; the
- * result should be UTF-8 encoded and cannot be larger than the input.
- * The result must also still be 0-terminated.
- *
- * @param cls closure (use NULL)
- * @param connection handle to connection, not used
- * @param val value to unescape (modified in the process)
- * @return length of the resulting val (strlen(val) maybe
- * shorter afterwards due to elimination of escape sequences)
- */
-size_t
-MHD_http_unescape (void *cls,
- struct MHD_Connection *connection,
- char *val);
-
/**
* Header or cookie in HTTP request or response.
*/
Modified: libmicrohttpd/src/microhttpd/postprocessor.c
===================================================================
--- libmicrohttpd/src/microhttpd/postprocessor.c 2014-12-19 23:17:14 UTC
(rev 34712)
+++ libmicrohttpd/src/microhttpd/postprocessor.c 2014-12-19 23:38:18 UTC
(rev 34713)
@@ -382,7 +382,7 @@
buf[pp->buffer_pos] = '\0'; /* 0-terminate key */
pp->buffer_pos = 0; /* reset for next key */
MHD_unescape_plus (buf);
- MHD_http_unescape (NULL, NULL, buf);
+ MHD_http_unescape (buf);
poff += equals + 1;
pp->state = PP_ProcessValue;
pp->value_offset = 0;
@@ -443,7 +443,7 @@
/* unescape */
xbuf[xoff] = '\0'; /* 0-terminate in preparation */
MHD_unescape_plus (xbuf);
- xoff = MHD_http_unescape (NULL, NULL, xbuf);
+ xoff = MHD_http_unescape (xbuf);
/* finally: call application! */
pp->must_ikvi = MHD_NO;
if (MHD_NO == pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *)
&pp[1], /* key */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34713 - in libmicrohttpd: . doc src/include src/microhttpd,
gnunet <=