diff options
Diffstat (limited to 'src/daemon/fileserver_example.c')
-rw-r--r-- | src/daemon/fileserver_example.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/daemon/fileserver_example.c b/src/daemon/fileserver_example.c index c5bf762b..9f86fd2c 100644 --- a/src/daemon/fileserver_example.c +++ b/src/daemon/fileserver_example.c | |||
@@ -52,8 +52,9 @@ ahc_echo (void *cls, | |||
52 | const char *url, | 52 | const char *url, |
53 | const char *method, | 53 | const char *method, |
54 | const char *upload_data, | 54 | const char *upload_data, |
55 | const char *version, unsigned int *upload_data_size, void **unused) | 55 | const char *version, unsigned int *upload_data_size, void **ptr) |
56 | { | 56 | { |
57 | static int aptr; | ||
57 | struct MHD_Response *response; | 58 | struct MHD_Response *response; |
58 | int ret; | 59 | int ret; |
59 | FILE *file; | 60 | FILE *file; |
@@ -61,6 +62,13 @@ ahc_echo (void *cls, | |||
61 | 62 | ||
62 | if (0 != strcmp (method, "GET")) | 63 | if (0 != strcmp (method, "GET")) |
63 | return MHD_NO; /* unexpected method */ | 64 | return MHD_NO; /* unexpected method */ |
65 | if (&aptr != *ptr) | ||
66 | { | ||
67 | /* do never respond on first call */ | ||
68 | *ptr = &aptr; | ||
69 | return MHD_YES; | ||
70 | } | ||
71 | *ptr = NULL; /* reset when done */ | ||
64 | file = fopen (&url[1], "r"); | 72 | file = fopen (&url[1], "r"); |
65 | if (file == NULL) | 73 | if (file == NULL) |
66 | { | 74 | { |