diff options
Diffstat (limited to 'src/lib/response_from_fd.c')
-rw-r--r-- | src/lib/response_from_fd.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/response_from_fd.c b/src/lib/response_from_fd.c index 6eac3f7f..ac0a54d1 100644 --- a/src/lib/response_from_fd.c +++ b/src/lib/response_from_fd.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff | 3 | Copyright (C) 2007-2019 Daniel Pittman, Christian Grothoff and |
4 | Karlson2k (Evgeny Grin) | ||
4 | 5 | ||
5 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of the GNU Lesser General Public |
@@ -28,6 +29,18 @@ | |||
28 | 29 | ||
29 | 30 | ||
30 | /** | 31 | /** |
32 | * Size of single file read operation for | ||
33 | * file-backed responses. | ||
34 | */ | ||
35 | #ifndef MHD_FILE_READ_BLOCK_SIZE | ||
36 | #ifdef _WIN32 | ||
37 | #define MHD_FILE_READ_BLOCK_SIZE 16384 /* 16k */ | ||
38 | #else /* _WIN32 */ | ||
39 | #define MHD_FILE_READ_BLOCK_SIZE 4096 /* 4k */ | ||
40 | #endif /* _WIN32 */ | ||
41 | #endif /* !MHD_FD_BLOCK_SIZE */ | ||
42 | |||
43 | /** | ||
31 | * Given a file descriptor, read data from the file | 44 | * Given a file descriptor, read data from the file |
32 | * to generate the response. | 45 | * to generate the response. |
33 | * | 46 | * |
@@ -182,7 +195,7 @@ MHD_response_from_fd (enum MHD_HTTP_StatusCode sc, | |||
182 | 195 | ||
183 | response = MHD_response_from_callback (sc, | 196 | response = MHD_response_from_callback (sc, |
184 | size, | 197 | size, |
185 | MHD_FD_BLOCK_SIZE, | 198 | MHD_FILE_READ_BLOCK_SIZE, |
186 | &file_reader, | 199 | &file_reader, |
187 | NULL, | 200 | NULL, |
188 | &free_callback); | 201 | &free_callback); |