aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsilvioprog <silvioprog@gmail.com>2018-12-06 12:54:00 -0300
committersilvioprog <silvioprog@gmail.com>2018-12-06 12:54:00 -0300
commitb220303691d627ca3cfe0d949c6aa2257b722c60 (patch)
tree76cb426d1ef26437464d86313ce25fc9ea98898f
parent53674dcdfba0ade96b50672a709edae1eae0323a (diff)
downloadlibmicrohttpd-b220303691d627ca3cfe0d949c6aa2257b722c60.tar.gz
libmicrohttpd-b220303691d627ca3cfe0d949c6aa2257b722c60.zip
Optimized the function MHD_create_response_from_callback() for Windows by increasing its internal buffer size and allowed to customize it via macro MHD_FD_BLOCK_SIZE.
-rw-r--r--ChangeLog7
-rw-r--r--src/lib/mhd_limits.h8
-rw-r--r--src/lib/response_from_fd.c2
-rw-r--r--src/microhttpd/mhd_limits.h8
-rw-r--r--src/microhttpd/response.c2
5 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f401a6b..6f27395d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
1Thu Dec 6 02:11:15 -03 2018 1Thu Dec 6 12:50:11 BRT 2018
2 Optimized the function MHD_create_response_from_callback() for
3 Windows by increasing its internal buffer size and allowed to customize
4 it via macro MHD_FD_BLOCK_SIZE. -SC
5
6Thu Dec 6 02:11:15 BRT 2018
2 Referenced the gnutls_load_file() function in the HTTPs examples. -SC 7 Referenced the gnutls_load_file() function in the HTTPs examples. -SC
3 8
4Wed Dec 5 18:08:59 CET 2018 9Wed Dec 5 18:08:59 CET 2018
diff --git a/src/lib/mhd_limits.h b/src/lib/mhd_limits.h
index 1b0f5d7d..41d33a8f 100644
--- a/src/lib/mhd_limits.h
+++ b/src/lib/mhd_limits.h
@@ -143,4 +143,12 @@
143#endif /* _WIN32 */ 143#endif /* _WIN32 */
144#endif /* !TIMEVAL_TV_SEC_MAX */ 144#endif /* !TIMEVAL_TV_SEC_MAX */
145 145
146#ifndef MHD_FD_BLOCK_SIZE
147#ifdef _WIN32
148#define MHD_FD_BLOCK_SIZE 16384 /* 16k */
149#else /* _WIN32 */
150#define MHD_FD_BLOCK_SIZE 4096 /* 4k */
151#endif /* _WIN32 */
152#endif /* !MHD_FD_BLOCK_SIZE */
153
146#endif /* MHD_LIMITS_H */ 154#endif /* MHD_LIMITS_H */
diff --git a/src/lib/response_from_fd.c b/src/lib/response_from_fd.c
index cdeb7aa5..6eac3f7f 100644
--- a/src/lib/response_from_fd.c
+++ b/src/lib/response_from_fd.c
@@ -182,7 +182,7 @@ MHD_response_from_fd (enum MHD_HTTP_StatusCode sc,
182 182
183 response = MHD_response_from_callback (sc, 183 response = MHD_response_from_callback (sc,
184 size, 184 size,
185 4 * 1024, 185 MHD_FD_BLOCK_SIZE,
186 &file_reader, 186 &file_reader,
187 NULL, 187 NULL,
188 &free_callback); 188 &free_callback);
diff --git a/src/microhttpd/mhd_limits.h b/src/microhttpd/mhd_limits.h
index 1b0f5d7d..41d33a8f 100644
--- a/src/microhttpd/mhd_limits.h
+++ b/src/microhttpd/mhd_limits.h
@@ -143,4 +143,12 @@
143#endif /* _WIN32 */ 143#endif /* _WIN32 */
144#endif /* !TIMEVAL_TV_SEC_MAX */ 144#endif /* !TIMEVAL_TV_SEC_MAX */
145 145
146#ifndef MHD_FD_BLOCK_SIZE
147#ifdef _WIN32
148#define MHD_FD_BLOCK_SIZE 16384 /* 16k */
149#else /* _WIN32 */
150#define MHD_FD_BLOCK_SIZE 4096 /* 4k */
151#endif /* _WIN32 */
152#endif /* !MHD_FD_BLOCK_SIZE */
153
146#endif /* MHD_LIMITS_H */ 154#endif /* MHD_LIMITS_H */
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 21e23a8a..29edef4f 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -566,7 +566,7 @@ MHD_create_response_from_fd_at_offset64 (uint64_t size,
566 return NULL; 566 return NULL;
567 567
568 response = MHD_create_response_from_callback (size, 568 response = MHD_create_response_from_callback (size,
569 4 * 1024, 569 MHD_FD_BLOCK_SIZE,
570 &file_reader, 570 &file_reader,
571 NULL, 571 NULL,
572 &free_callback); 572 &free_callback);