aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-08-23 12:36:18 +0000
committerChristian Grothoff <christian@grothoff.org>2012-08-23 12:36:18 +0000
commitbf92eff1f850b9d2ed436bc05f163457007cbdef (patch)
tree6a7a901399f2098c3cdc84604a11bfe146e83f27 /doc
parent5133b28b095aa37938ff6f7a82b4235918057d40 (diff)
downloadlibmicrohttpd-bf92eff1f850b9d2ed436bc05f163457007cbdef.tar.gz
libmicrohttpd-bf92eff1f850b9d2ed436bc05f163457007cbdef.zip
close file, clarify license
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/basicauthentication.c3
-rw-r--r--doc/examples/hellobrowser.c3
-rw-r--r--doc/examples/largepost.c19
-rw-r--r--doc/examples/logging.c3
-rw-r--r--doc/examples/responseheaders.c3
-rw-r--r--doc/examples/sessions.c25
-rw-r--r--doc/examples/simplepost.c3
-rw-r--r--doc/examples/tlsauthentication.c3
8 files changed, 33 insertions, 29 deletions
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c
index da617098..fa99dc37 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>
diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c
index 58795ca5..bbfc990f 100644
--- a/doc/examples/hellobrowser.c
+++ b/doc/examples/hellobrowser.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index 15a88341..56960d50 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>
@@ -108,6 +111,7 @@ iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
108 return MHD_YES; 111 return MHD_YES;
109} 112}
110 113
114
111static void 115static void
112request_completed (void *cls, struct MHD_Connection *connection, 116request_completed (void *cls, struct MHD_Connection *connection,
113 void **con_cls, enum MHD_RequestTerminationCode toe) 117 void **con_cls, enum MHD_RequestTerminationCode toe)
@@ -200,29 +204,32 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
200 return MHD_YES; 204 return MHD_YES;
201 } 205 }
202 else 206 else
203 return send_page (connection, con_info->answerstring, 207 {
204 con_info->answercode); 208 if (NULL != con_info->fp)
209 fclose (con_info->fp);
210 /* Now it is safe to open and inspect the file before calling send_page with a response */
211 return send_page (connection, con_info->answerstring,
212 con_info->answercode);
213 }
214
205 } 215 }
206 216
207 return send_page (connection, errorpage, MHD_HTTP_BAD_REQUEST); 217 return send_page (connection, errorpage, MHD_HTTP_BAD_REQUEST);
208} 218}
209 219
220
210int 221int
211main () 222main ()
212{ 223{
213 struct MHD_Daemon *daemon; 224 struct MHD_Daemon *daemon;
214 225
215
216 daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, 226 daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL,
217 &answer_to_connection, NULL, 227 &answer_to_connection, NULL,
218 MHD_OPTION_NOTIFY_COMPLETED, request_completed, 228 MHD_OPTION_NOTIFY_COMPLETED, request_completed,
219 NULL, MHD_OPTION_END); 229 NULL, MHD_OPTION_END);
220 if (NULL == daemon) 230 if (NULL == daemon)
221 return 1; 231 return 1;
222
223 getchar (); 232 getchar ();
224
225 MHD_stop_daemon (daemon); 233 MHD_stop_daemon (daemon);
226
227 return 0; 234 return 0;
228} 235}
diff --git a/doc/examples/logging.c b/doc/examples/logging.c
index 180a9c5c..b8d0341d 100644
--- a/doc/examples/logging.c
+++ b/doc/examples/logging.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index 6108ed97..2931c779 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 6bb81a0b..5961037a 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -1,26 +1,5 @@
1/* 1/* Feel free to use this example code in any way
2 This file is part of libmicrohttpd 2 you see fit (Public Domain) */
3 (C) 2011 Christian Grothoff (and other contributing authors)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19/**
20 * @file post_example.c
21 * @brief example for processing POST requests using libmicrohttpd
22 * @author Christian Grothoff
23 */
24 3
25/* needed for asprintf */ 4/* needed for asprintf */
26#define _GNU_SOURCE 5#define _GNU_SOURCE
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
index eb0fde04..98a97624 100644
--- a/doc/examples/simplepost.c
+++ b/doc/examples/simplepost.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
index aefc7e75..0127a40c 100644
--- a/doc/examples/tlsauthentication.c
+++ b/doc/examples/tlsauthentication.c
@@ -1,3 +1,6 @@
1/* Feel free to use this example code in any way
2 you see fit (Public Domain) */
3
1#include <sys/types.h> 4#include <sys/types.h>
2#include <sys/select.h> 5#include <sys/select.h>
3#include <sys/socket.h> 6#include <sys/socket.h>