aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/minimal_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/minimal_example.c')
-rw-r--r--src/daemon/minimal_example.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/daemon/minimal_example.c b/src/daemon/minimal_example.c
index 62ee5ae5..badff7a2 100644
--- a/src/daemon/minimal_example.c
+++ b/src/daemon/minimal_example.c
@@ -41,14 +41,22 @@ ahc_echo (void *cls,
41 const char *url, 41 const char *url,
42 const char *method, 42 const char *method,
43 const char *upload_data, 43 const char *upload_data,
44 const char *version, unsigned int *upload_data_size, void **unused) 44 const char *version, unsigned int *upload_data_size, void **ptr)
45{ 45{
46 static int aptr;
46 const char *me = cls; 47 const char *me = cls;
47 struct MHD_Response *response; 48 struct MHD_Response *response;
48 int ret; 49 int ret;
49 50
50 if (0 != strcmp (method, "GET")) 51 if (0 != strcmp (method, "GET"))
51 return MHD_NO; /* unexpected method */ 52 return MHD_NO; /* unexpected method */
53 if (&aptr != *ptr)
54 {
55 /* do never respond on first call */
56 *ptr = &aptr;
57 return MHD_YES;
58 }
59 *ptr = NULL; /* reset when done */
52 response = MHD_create_response_from_data (strlen (me), 60 response = MHD_create_response_from_data (strlen (me),
53 (void *) me, MHD_NO, MHD_NO); 61 (void *) me, MHD_NO, MHD_NO);
54 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 62 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);