diff options
Diffstat (limited to 'src/examples/authorization_example.c')
-rw-r--r-- | src/examples/authorization_example.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c index b271053e..60512183 100644 --- a/src/examples/authorization_example.c +++ b/src/examples/authorization_example.c | |||
@@ -63,17 +63,18 @@ ahc_echo (void *cls, | |||
63 | (0 != strcmp (auth, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="))) | 63 | (0 != strcmp (auth, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="))) |
64 | { | 64 | { |
65 | /* require: "Aladdin" with password "open sesame" */ | 65 | /* require: "Aladdin" with password "open sesame" */ |
66 | response = MHD_create_response_from_data (strlen (DENIED), | 66 | response = MHD_create_response_from_buffer (strlen (DENIED), |
67 | (void *) DENIED, MHD_NO, | 67 | (void *) DENIED, |
68 | MHD_NO); | 68 | MHD_RESPMEM_PERSISTENT); |
69 | MHD_add_response_header (response, MHD_HTTP_HEADER_WWW_AUTHENTICATE, | 69 | MHD_add_response_header (response, MHD_HTTP_HEADER_WWW_AUTHENTICATE, |
70 | "Basic realm=\"TestRealm\""); | 70 | "Basic realm=\"TestRealm\""); |
71 | code = MHD_HTTP_UNAUTHORIZED; | 71 | code = MHD_HTTP_UNAUTHORIZED; |
72 | } | 72 | } |
73 | else | 73 | else |
74 | { | 74 | { |
75 | response = MHD_create_response_from_data (strlen (me), | 75 | response = MHD_create_response_from_buffer (strlen (me), |
76 | (void *) me, MHD_NO, MHD_NO); | 76 | (void *) me, |
77 | MHD_RESPMEM_PERSISTENT); | ||
77 | code = MHD_HTTP_OK; | 78 | code = MHD_HTTP_OK; |
78 | } | 79 | } |
79 | ret = MHD_queue_response (connection, code, response); | 80 | ret = MHD_queue_response (connection, code, response); |