aboutsummaryrefslogtreecommitdiff
path: root/src/include/microhttpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r--src/include/microhttpd.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index f123969b..c63e43bb 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1199,6 +1199,8 @@ struct MHD_Response *MHD_create_response_from_callback (uint64_t size,
1199 MHD_ContentReaderFreeCallback 1199 MHD_ContentReaderFreeCallback
1200 crfc); 1200 crfc);
1201 1201
1202
1203
1202/** 1204/**
1203 * Create a response object. The response object can be extended with 1205 * Create a response object. The response object can be extended with
1204 * header information and then be used any number of times. 1206 * header information and then be used any number of times.
@@ -1210,6 +1212,7 @@ struct MHD_Response *MHD_create_response_from_callback (uint64_t size,
1210 * right away, the data maybe released anytime after 1212 * right away, the data maybe released anytime after
1211 * this call returns 1213 * this call returns
1212 * @return NULL on error (i.e. invalid arguments, out of memory) 1214 * @return NULL on error (i.e. invalid arguments, out of memory)
1215 * @deprecated use MHD_create_response_from_buffer instead
1213 */ 1216 */
1214struct MHD_Response *MHD_create_response_from_data (size_t size, 1217struct MHD_Response *MHD_create_response_from_data (size_t size,
1215 void *data, 1218 void *data,
@@ -1218,12 +1221,59 @@ struct MHD_Response *MHD_create_response_from_data (size_t size,
1218 1221
1219 1222
1220/** 1223/**
1224 * Specification for how MHD should treat the memory buffer
1225 * given for the response.
1226 */
1227enum MHD_ResponseMemoryMode {
1228
1229 /**
1230 * Buffer is a persistent (static/global) buffer that won't change
1231 * for at least the lifetime of the response, MHD should just use
1232 * it, not free it, not copy it, just keep an alias to it.
1233 */
1234 MHD_RESPMEM_PERSISTENT,
1235
1236 /**
1237 * Buffer is heap-allocated with 'malloc' (or equivalent) and
1238 * should be freed by MHD after processing the response has
1239 * concluded (response reference counter reaches zero).
1240 */
1241 MHD_RESPMEM_MUST_FREE,
1242
1243 /**
1244 * Buffer is in transient memory, but not on the heap (for example,
1245 * on the stack or non-malloc allocated) and only valid during the
1246 * call to 'MHD_create_response_from_buffer'. MHD must make its
1247 * own private copy of the data for processing.
1248 */
1249 MHD_RESPMEM_MUST_COPY
1250
1251};
1252
1253
1254/**
1255 * Create a response object. The response object can be extended with
1256 * header information and then be used any number of times.
1257 *
1258 * @param size size of the data portion of the response
1259 * @param buffer size bytes containing the response's data portion
1260 * @param mode flags for buffer management
1261 * @return NULL on error (i.e. invalid arguments, out of memory)
1262 */
1263struct MHD_Response *
1264MHD_create_response_from_buffer (size_t size,
1265 void *buffer,
1266 enum MHD_ResponseMemoryMode mode);
1267
1268
1269/**
1221 * Create a response object. The response object can be extended with 1270 * Create a response object. The response object can be extended with
1222 * header information and then be used any number of times. 1271 * header information and then be used any number of times.
1223 * 1272 *
1224 * @param size size of the data portion of the response 1273 * @param size size of the data portion of the response
1225 * @param fd file descriptor referring to a file on disk with the data; will be closed when response is destroyed 1274 * @param fd file descriptor referring to a file on disk with the data; will be closed when response is destroyed
1226 * @return NULL on error (i.e. invalid arguments, out of memory) 1275 * @return NULL on error (i.e. invalid arguments, out of memory)
1276 * @deprecated use MHD_create_response_from_fd_at_offset instead
1227 */ 1277 */
1228struct MHD_Response *MHD_create_response_from_fd (size_t size, 1278struct MHD_Response *MHD_create_response_from_fd (size_t size,
1229 int fd); 1279 int fd);