[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13683 - in libmicrohttpd: . doc src/daemon src/include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13683 - in libmicrohttpd: . doc src/daemon src/include |
Date: |
Sun, 14 Nov 2010 20:49:13 +0100 |
Author: grothoff
Date: 2010-11-14 20:49:13 +0100 (Sun, 14 Nov 2010)
New Revision: 13683
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/doc/microhttpd.texi
libmicrohttpd/src/daemon/EXPORT.sym
libmicrohttpd/src/daemon/response.c
libmicrohttpd/src/include/microhttpd.h
Log:
footer support
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2010-11-14 19:26:03 UTC (rev 13682)
+++ libmicrohttpd/ChangeLog 2010-11-14 19:49:13 UTC (rev 13683)
@@ -1,3 +1,6 @@
+Sun Nov 14 20:45:45 CET 2010
+ Adding API call to generate HTTP footers in response. -CG
+
Sat Oct 16 12:38:43 CEST 2010
Releasing libmicrohttpd 0.9.2. -CG
Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi 2010-11-14 19:26:03 UTC (rev 13682)
+++ libmicrohttpd/doc/microhttpd.texi 2010-11-14 19:49:13 UTC (rev 13683)
@@ -1327,8 +1327,26 @@
@end deftypefun
address@hidden int MHD_add_response_footer (struct MHD_Response *response,
const char *footer, const char *content)
+Add a footer line to the response. The strings referenced by
address@hidden and @var{content} must be zero-terminated and they are
+duplicated into memory blocks embedded in @var{response}.
+
+Notice that the strings must not hold newlines, carriage returns or tab
+chars. You can add response footers at any time before signalling the
+end of the response to MHD (not just before calling 'MHD_queue_response').
+Footers are useful for adding cryptographic checksums to the reply or to
+signal errors encountered during data generation. This call was introduced
+in MHD 0.9.3.
+
+Return @code{MHD_NO} on error (i.e. invalid header or content format or
+memory allocation error).
address@hidden deftypefun
+
+
+
@deftypefun int MHD_del_response_header (struct MHD_Response *response, const
char *header, const char *content)
-Delete a header line from the response. Return @code{MHD_NO} on error
+Delete a header (or footer) line from the response. Return @code{MHD_NO} on
error
(arguments are invalid or no such header known).
@end deftypefun
Modified: libmicrohttpd/src/daemon/EXPORT.sym
===================================================================
--- libmicrohttpd/src/daemon/EXPORT.sym 2010-11-14 19:26:03 UTC (rev 13682)
+++ libmicrohttpd/src/daemon/EXPORT.sym 2010-11-14 19:49:13 UTC (rev 13683)
@@ -13,6 +13,7 @@
MHD_create_response_from_fd
MHD_destroy_response
MHD_add_response_header
+MHD_add_response_footer
MHD_del_response_header
MHD_get_response_headers
MHD_get_response_header
Modified: libmicrohttpd/src/daemon/response.c
===================================================================
--- libmicrohttpd/src/daemon/response.c 2010-11-14 19:26:03 UTC (rev 13682)
+++ libmicrohttpd/src/daemon/response.c 2010-11-14 19:49:13 UTC (rev 13683)
@@ -27,14 +27,21 @@
#include "internal.h"
#include "response.h"
+
/**
- * Add a header line to the response.
+ * Add a header or footer line to the response.
*
+ * @param response response to add a header to
+ * @param kind header or footer
+ * @param header the header to add
+ * @param content value to add
* @return MHD_NO on error (i.e. invalid header or content format).
*/
-int
-MHD_add_response_header (struct MHD_Response *response,
- const char *header, const char *content)
+static int
+add_response_entry (struct MHD_Response *response,
+ enum MHD_ValueKind kind,
+ const char *header,
+ const char *content)
{
struct MHD_HTTP_Header *hdr;
@@ -65,15 +72,57 @@
free (hdr);
return MHD_NO;
}
- hdr->kind = MHD_HEADER_KIND;
+ hdr->kind = kind;
hdr->next = response->first_header;
response->first_header = hdr;
return MHD_YES;
}
+
/**
+ * Add a header line to the response.
+ *
+ * @param response response to add a header to
+ * @param header the header to add
+ * @param content value to add
+ * @return MHD_NO on error (i.e. invalid header or content format).
+ */
+int
+MHD_add_response_header (struct MHD_Response *response,
+ const char *header, const char *content)
+{
+ return add_response_entry (response,
+ MHD_HEADER_KIND,
+ header,
+ content);
+}
+
+
+/**
+ * Add a footer line to the response.
+ *
+ * @param response response to remove a header from
+ * @param footer the footer to delete
+ * @param content value to delete
+ * @return MHD_NO on error (i.e. invalid footer or content format).
+ */
+int
+MHD_add_response_footer (struct MHD_Response *response,
+ const char *footer, const char *content)
+{
+ return add_response_entry (response,
+ MHD_FOOTER_KIND,
+ header,
+ content);
+}
+
+
+/**
* Delete a header line from the response.
*
+ * @param response response to remove a header from
+ * @param header the header to delete
+ * @param content value to delete
* @return MHD_NO on error (no such header known)
*/
int
@@ -107,6 +156,7 @@
return MHD_NO;
}
+
/**
* Get all of the headers added to a response.
*
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2010-11-14 19:26:03 UTC (rev
13682)
+++ libmicrohttpd/src/include/microhttpd.h 2010-11-14 19:49:13 UTC (rev
13683)
@@ -106,7 +106,7 @@
/**
* Current version of the library.
*/
-#define MHD_VERSION 0x00090200
+#define MHD_VERSION 0x00090201
/**
* MHD-internal return code for "YES".
@@ -1194,10 +1194,24 @@
MHD_add_response_header (struct MHD_Response *response,
const char *header, const char *content);
+
/**
- * Delete a header line from the response.
+ * Add a footer line to the response.
*
* @param response response to remove a header from
+ * @param footer the footer to delete
+ * @param content value to delete
+ * @return MHD_NO on error (i.e. invalid footer or content format).
+ */
+int
+MHD_add_response_footer (struct MHD_Response *response,
+ const char *footer, const char *content);
+
+
+/**
+ * Delete a header (or footer) line from the response.
+ *
+ * @param response response to remove a header from
* @param header the header to delete
* @param content value to delete
* @return MHD_NO on error (no such header known)
@@ -1207,7 +1221,7 @@
const char *header, const char *content);
/**
- * Get all of the headers added to a response.
+ * Get all of the headers (and footers) added to a response.
*
* @param response response to query
* @param iterator callback to call on each header;
@@ -1221,7 +1235,7 @@
/**
- * Get a particular header from the response.
+ * Get a particular header (or footer) from the response.
*
* @param response response to query
* @param key which header to get
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13683 - in libmicrohttpd: . doc src/daemon src/include,
gnunet <=