[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13069 - libmicrohttpd/doc/chapters
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13069 - libmicrohttpd/doc/chapters |
Date: |
Thu, 23 Sep 2010 09:38:01 +0200 |
Author: grothoff
Date: 2010-09-23 09:38:01 +0200 (Thu, 23 Sep 2010)
New Revision: 13069
Modified:
libmicrohttpd/doc/chapters/hellobrowser.inc
Log:
formatting
Modified: libmicrohttpd/doc/chapters/hellobrowser.inc
===================================================================
--- libmicrohttpd/doc/chapters/hellobrowser.inc 2010-09-23 07:35:19 UTC (rev
13068)
+++ libmicrohttpd/doc/chapters/hellobrowser.inc 2010-09-23 07:38:01 UTC (rev
13069)
@@ -17,7 +17,9 @@
#include <microhttpd.h>
#define PORT 8888
+
@end verbatim
+
@noindent
the desired behaviour of our server when HTTP request arrive has to be
implemented. We already have
agreed that it should not care about the particular details of the request,
such as who is requesting
@@ -44,7 +46,9 @@
size_t *upload_data_size, void **con_cls)
{
const char *page = "<html><body>Hello, browser!</body></html>";
+
@end verbatim
+
@noindent
HTTP is a rather strict protocol and the client would certainly consider it
"inappropriate" if we
just sent the answer string "as is". Instead, it has to be wrapped with
additional information stored in so-called headers and footers. Most of the
work in this area is done by the library for us---we
@@ -60,7 +64,9 @@
response = MHD_create_response_from_data (strlen (page),
(void*) page, MHD_NO, MHD_NO);
+
@end verbatim
+
@noindent
Now that the the response has been laced up, it is ready for delivery and can
be queued for sending.
This is done by passing it to another @emph{GNU libmicrohttpd} function. As
all our work was done in
@@ -78,7 +84,9 @@
return ret;
}
+
@end verbatim
+
@noindent
With the primary task of our server implemented, we can start the actual
server daemon which will listen
on @code{PORT} for connections. This is done in the main function.
@@ -90,7 +98,9 @@
daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL,
&answer_to_connection, NULL, MHD_OPTION_END);
if (NULL == daemon) return 1;
+
@end verbatim
+
@noindent
The first parameter is one of three possible modes of operation. Here we want
the daemon to run in
a separate thread and to manage all incoming connections in the same thread.
This means that while
@@ -118,6 +128,7 @@
}
@end verbatim
+
@noindent
The first example is now complete.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13069 - libmicrohttpd/doc/chapters,
gnunet <=