aboutsummaryrefslogtreecommitdiff
path: root/doc/examples/responseheaders.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-21 10:33:44 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-21 10:33:44 +0100
commit52a5e465844add3dd968f2318eab5e6f91a5a1e7 (patch)
tree456561899f7df6d0056deee9ce4c507a30c05abd /doc/examples/responseheaders.c
parent9131da3340181d97d9deca4403a4bcd3d59236a4 (diff)
downloadlibmicrohttpd-52a5e465844add3dd968f2318eab5e6f91a5a1e7.tar.gz
libmicrohttpd-52a5e465844add3dd968f2318eab5e6f91a5a1e7.zip
use correct HTTP header (content type, not content encoding) for mime type in example; do check return value in example
Diffstat (limited to 'doc/examples/responseheaders.c')
-rw-r--r--doc/examples/responseheaders.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index 30ac4596..cddcaa66 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -63,9 +63,21 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
63 return MHD_NO; 63 return MHD_NO;
64 } 64 }
65 response = 65 response =
66 MHD_create_response_from_fd_at_offset64 ((size_t) sbuf.st_size, fd, 0); 66 MHD_create_response_from_fd_at_offset64 ((size_t) sbuf.st_size,
67 MHD_add_response_header (response, "Content-Type", MIMETYPE); 67 fd,
68 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 68 0);
69 if (MHD_YES !=
70 MHD_add_response_header (response,
71 MHD_HTTP_HEADER_CONTENT_TYPE,
72 MIMETYPE))
73 {
74 fprintf (stderr,
75 "Failed to set content encoding type!\n");
76 /* return response without content encoding anyway ... */
77 }
78 ret = MHD_queue_response (connection,
79 MHD_HTTP_OK,
80 response);
69 MHD_destroy_response (response); 81 MHD_destroy_response (response);
70 82
71 return ret; 83 return ret;