[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30427 - in libmicrohttpd: . src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30427 - in libmicrohttpd: . src/microhttpd |
Date: |
Sun, 27 Oct 2013 15:22:22 +0100 |
Author: grothoff
Date: 2013-10-27 15:22:22 +0100 (Sun, 27 Oct 2013)
New Revision: 30427
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/src/microhttpd/postprocessor.c
Log:
-improve POST processing performance
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2013-10-27 14:22:08 UTC (rev 30426)
+++ libmicrohttpd/ChangeLog 2013-10-27 14:22:22 UTC (rev 30427)
@@ -1,3 +1,7 @@
+Sun Oct 27 15:19:44 CET 2013
+ Implementing faster processing of upload data in multipart
+ encoding (thanks to performance analysis by Adam Homolya). -CG
+
Thu Oct 24 10:40:03 CEST 2013
Adding support for connection flow control via
MHD_suspend_connection and MHD_resume_connection. -CG
Modified: libmicrohttpd/src/microhttpd/postprocessor.c
===================================================================
--- libmicrohttpd/src/microhttpd/postprocessor.c 2013-10-27 14:22:08 UTC
(rev 30426)
+++ libmicrohttpd/src/microhttpd/postprocessor.c 2013-10-27 14:22:22 UTC
(rev 30427)
@@ -308,7 +308,7 @@
/* remove enclosing quotes */
++boundary;
blen -= 2;
- }
+ }
}
else
blen = 0;
@@ -564,8 +564,8 @@
* If destination is already non-NULL, do nothing.
*/
static void
-try_get_value (const char *buf,
- const char *key,
+try_get_value (const char *buf,
+ const char *key,
char **destination)
{
const char *spos;
@@ -676,8 +676,8 @@
* boundary was found
* @param next_dash_state state to go into if the next
* boundary ends with "--"
- * @return MHD_YES if we can continue processing,
- * MHD_NO on error or if we do not have
+ * @return #MHD_YES if we can continue processing,
+ * #MHD_NO on error or if we do not have
* enough data yet
*/
static int
@@ -690,15 +690,26 @@
{
char *buf = (char *) &pp[1];
size_t newline;
+ const char *r;
/* all data in buf until the boundary
(\r\n--+boundary) is part of the value */
newline = 0;
while (1)
{
- while ((newline + 4 < pp->buffer_pos) &&
- (0 != memcmp ("\r\n--", &buf[newline], 4)))
- newline++;
+ while (newline + 4 < pp->buffer_pos)
+ {
+ r = memchr (&buf[newline], '\r', pp->buffer_pos - newline);
+ if (NULL == r)
+ {
+ newline = pp->buffer_pos - 4;
+ break;
+ }
+ newline = r - buf;
+ if (0 == memcmp ("\r\n--", &buf[newline], 4))
+ break;
+ newline++;
+ }
if (newline + pp->blen + 4 <= pp->buffer_pos)
{
/* can check boundary */
@@ -794,7 +805,7 @@
* @param pp post processor context
* @param post_data data to decode
* @param post_data_len number of bytes in @a post_data
- * @return #MHD_NO on error,
+ * @return #MHD_NO on error,
*/
static int
post_process_multipart (struct MHD_PostProcessor *pp,
@@ -1147,7 +1158,7 @@
/* These internal strings need cleaning up since
the post-processing may have been interrupted
at any stage */
- if ((pp->xbuf_pos > 0) ||
+ if ((pp->xbuf_pos > 0) ||
( (pp->state != PP_Done) &&
(pp->state != PP_ExpectNewLine)))
ret = MHD_NO;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30427 - in libmicrohttpd: . src/microhttpd,
gnunet <=