[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7532 - in libmicrohttpd: doc src/daemon src/include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7532 - in libmicrohttpd: doc src/daemon src/include |
Date: |
Wed, 6 Aug 2008 10:32:12 -0600 (MDT) |
Author: grothoff
Date: 2008-08-06 10:32:11 -0600 (Wed, 06 Aug 2008)
New Revision: 7532
Modified:
libmicrohttpd/doc/microhttpd.texi
libmicrohttpd/src/daemon/connection.c
libmicrohttpd/src/include/microhttpd.h
Log:
fixing 1399
Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi 2008-08-06 16:30:47 UTC (rev 7531)
+++ libmicrohttpd/doc/microhttpd.texi 2008-08-06 16:32:11 UTC (rev 7532)
@@ -695,6 +695,36 @@
@end deftypefun
address@hidden int MHD_set_connection_value (struct MHD_Connection *connection,
enum MHD_ValueKind kind, const char * key, const char * value)
+This function can be used to add an entry to
+the HTTP headers of a connection (so that the
+MHD_get_connection_values function will return
+them -- and the MHD PostProcessor will also
+see them). This maybe required in certain
+situations (see Mantis #1399) where (broken)
+HTTP implementations fail to supply values needed
+by the post processor (or other parts of the
+application).
+
+This function MUST only be called from within
+the MHD_AccessHandlerCallback (otherwise, access
+maybe improperly synchronized). Furthermore,
+the client must guarantee that the key and
+value arguments are 0-terminated strings that
+are NOT freed until the connection is closed.
+(The easiest way to do this is by passing only
+arguments to permanently allocated strings.).
+
address@hidden is the connection for which
+the entry for @var{key} of the given @var{kind}
+should be set to the given @var{value}.
+
+The function returns @code{MHD_NO} if the operation
+could not be performed due to insufficient memory
+and @code{MHD_YES} on success.
address@hidden deftypefun
+
+
@deftypefun {const char *} MHD_lookup_connection_value (struct MHD_Connection
*connection, enum MHD_ValueKind kind, const char *key)
Get a particular header value. If multiple values match the @var{kind},
return one of them (the ``first'', whatever that means). @var{key} must
Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c 2008-08-06 16:30:47 UTC (rev
7531)
+++ libmicrohttpd/src/daemon/connection.c 2008-08-06 16:32:11 UTC (rev
7532)
@@ -148,6 +148,56 @@
}
/**
+ * This function can be used to add an entry to
+ * the HTTP headers of a connection (so that the
+ * MHD_get_connection_values function will return
+ * them -- and the MHD PostProcessor will also
+ * see them). This maybe required in certain
+ * situations (see Mantis #1399) where (broken)
+ * HTTP implementations fail to supply values needed
+ * by the post processor (or other parts of the
+ * application).
+ * <p>
+ * This function MUST only be called from within
+ * the MHD_AccessHandlerCallback (otherwise, access
+ * maybe improperly synchronized). Furthermore,
+ * the client must guarantee that the key and
+ * value arguments are 0-terminated strings that
+ * are NOT freed until the connection is closed.
+ * (The easiest way to do this is by passing only
+ * arguments to permanently allocated strings.).
+ *
+ * @param connection the connection for which a
+ * value should be set
+ * @param kind kind of the value
+ * @param key key for the value
+ * @param value the value itself
+ * @return MHD_NO if the operation could not be
+ * performed due to insufficient memory;
+ * MHD_YES on success
+ */
+int
+MHD_set_connection_value (struct MHD_Connection *connection,
+ enum MHD_ValueKind kind,
+ const char *key,
+ const char *value)
+{
+ struct MHD_HTTP_Header * pos;
+
+ pos = MHD_pool_allocate(connection->pool,
+ sizeof(struct MHD_HTTP_Header),
+ MHD_NO);
+ if (pos == NULL)
+ return MHD_NO;
+ pos->header = (char*) key;
+ pos->value = (char*) value;
+ pos->kind = kind;
+ pos->next = connection->headers_received;
+ connection->headers_received = pos;
+ return MHD_YES;
+}
+
+/**
* Get a particular header value. If multiple
* values match the kind, return any one of them.
*
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2008-08-06 16:30:47 UTC (rev
7531)
+++ libmicrohttpd/src/include/microhttpd.h 2008-08-06 16:32:11 UTC (rev
7532)
@@ -791,6 +791,41 @@
MHD_KeyValueIterator iterator, void *iterator_cls);
/**
+ * This function can be used to add an entry to
+ * the HTTP headers of a connection (so that the
+ * MHD_get_connection_values function will return
+ * them -- and the MHD PostProcessor will also
+ * see them). This maybe required in certain
+ * situations (see Mantis #1399) where (broken)
+ * HTTP implementations fail to supply values needed
+ * by the post processor (or other parts of the
+ * application).
+ * <p>
+ * This function MUST only be called from within
+ * the MHD_AccessHandlerCallback (otherwise, access
+ * maybe improperly synchronized). Furthermore,
+ * the client must guarantee that the key and
+ * value arguments are 0-terminated strings that
+ * are NOT freed until the connection is closed.
+ * (The easiest way to do this is by passing only
+ * arguments to permanently allocated strings.).
+ *
+ * @param connection the connection for which a
+ * value should be set
+ * @param kind kind of the value
+ * @param key key for the value
+ * @param value the value itself
+ * @return MHD_NO if the operation could not be
+ * performed due to insufficient memory;
+ * MHD_YES on success
+ */
+int
+MHD_set_connection_value (struct MHD_Connection *connection,
+ enum MHD_ValueKind kind,
+ const char *key,
+ const char *value);
+
+/**
* Get a particular header value. If multiple
* values match the kind, return any one of them.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7532 - in libmicrohttpd: doc src/daemon src/include,
gnunet <=