diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-11-14 19:49:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-11-14 19:49:13 +0000 |
commit | 11e2fba331a7009f37c7595ceb35999bf1f4d1c0 (patch) | |
tree | 15e01e380966e474f455f4d90c86bd40e940590e /src/daemon/response.c | |
parent | aa0ae46cbcbdd9eda1cbc88d70e3cab2deb2b068 (diff) | |
download | libmicrohttpd-11e2fba331a7009f37c7595ceb35999bf1f4d1c0.tar.gz libmicrohttpd-11e2fba331a7009f37c7595ceb35999bf1f4d1c0.zip |
footer support
Diffstat (limited to 'src/daemon/response.c')
-rw-r--r-- | src/daemon/response.c | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/src/daemon/response.c b/src/daemon/response.c index 6700bab1..478ab89c 100644 --- a/src/daemon/response.c +++ b/src/daemon/response.c | |||
@@ -27,14 +27,21 @@ | |||
27 | #include "internal.h" | 27 | #include "internal.h" |
28 | #include "response.h" | 28 | #include "response.h" |
29 | 29 | ||
30 | |||
30 | /** | 31 | /** |
31 | * Add a header line to the response. | 32 | * Add a header or footer line to the response. |
32 | * | 33 | * |
34 | * @param response response to add a header to | ||
35 | * @param kind header or footer | ||
36 | * @param header the header to add | ||
37 | * @param content value to add | ||
33 | * @return MHD_NO on error (i.e. invalid header or content format). | 38 | * @return MHD_NO on error (i.e. invalid header or content format). |
34 | */ | 39 | */ |
35 | int | 40 | static int |
36 | MHD_add_response_header (struct MHD_Response *response, | 41 | add_response_entry (struct MHD_Response *response, |
37 | const char *header, const char *content) | 42 | enum MHD_ValueKind kind, |
43 | const char *header, | ||
44 | const char *content) | ||
38 | { | 45 | { |
39 | struct MHD_HTTP_Header *hdr; | 46 | struct MHD_HTTP_Header *hdr; |
40 | 47 | ||
@@ -65,15 +72,57 @@ MHD_add_response_header (struct MHD_Response *response, | |||
65 | free (hdr); | 72 | free (hdr); |
66 | return MHD_NO; | 73 | return MHD_NO; |
67 | } | 74 | } |
68 | hdr->kind = MHD_HEADER_KIND; | 75 | hdr->kind = kind; |
69 | hdr->next = response->first_header; | 76 | hdr->next = response->first_header; |
70 | response->first_header = hdr; | 77 | response->first_header = hdr; |
71 | return MHD_YES; | 78 | return MHD_YES; |
72 | } | 79 | } |
73 | 80 | ||
81 | |||
82 | /** | ||
83 | * Add a header line to the response. | ||
84 | * | ||
85 | * @param response response to add a header to | ||
86 | * @param header the header to add | ||
87 | * @param content value to add | ||
88 | * @return MHD_NO on error (i.e. invalid header or content format). | ||
89 | */ | ||
90 | int | ||
91 | MHD_add_response_header (struct MHD_Response *response, | ||
92 | const char *header, const char *content) | ||
93 | { | ||
94 | return add_response_entry (response, | ||
95 | MHD_HEADER_KIND, | ||
96 | header, | ||
97 | content); | ||
98 | } | ||
99 | |||
100 | |||
101 | /** | ||
102 | * Add a footer line to the response. | ||
103 | * | ||
104 | * @param response response to remove a header from | ||
105 | * @param footer the footer to delete | ||
106 | * @param content value to delete | ||
107 | * @return MHD_NO on error (i.e. invalid footer or content format). | ||
108 | */ | ||
109 | int | ||
110 | MHD_add_response_footer (struct MHD_Response *response, | ||
111 | const char *footer, const char *content) | ||
112 | { | ||
113 | return add_response_entry (response, | ||
114 | MHD_FOOTER_KIND, | ||
115 | header, | ||
116 | content); | ||
117 | } | ||
118 | |||
119 | |||
74 | /** | 120 | /** |
75 | * Delete a header line from the response. | 121 | * Delete a header line from the response. |
76 | * | 122 | * |
123 | * @param response response to remove a header from | ||
124 | * @param header the header to delete | ||
125 | * @param content value to delete | ||
77 | * @return MHD_NO on error (no such header known) | 126 | * @return MHD_NO on error (no such header known) |
78 | */ | 127 | */ |
79 | int | 128 | int |
@@ -107,6 +156,7 @@ MHD_del_response_header (struct MHD_Response *response, | |||
107 | return MHD_NO; | 156 | return MHD_NO; |
108 | } | 157 | } |
109 | 158 | ||
159 | |||
110 | /** | 160 | /** |
111 | * Get all of the headers added to a response. | 161 | * Get all of the headers added to a response. |
112 | * | 162 | * |