aboutsummaryrefslogtreecommitdiff
path: root/picohttp.c
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de>2013-07-18 18:44:37 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de>2013-07-18 18:44:37 +0200
commit9fec30ee4e98dee6411280547d861a30c76c626a (patch)
tree1a4dc98e21f9993807308e89f1de77d5a0e210ef /picohttp.c
parentbee3c22a9a5156fe6a2b7f4a26b4d4f20cb7d8f1 (diff)
downloadlitheweb-9fec30ee4e98dee6411280547d861a30c76c626a.tar.gz
litheweb-9fec30ee4e98dee6411280547d861a30c76c626a.tar.bz2
start of branch
Diffstat (limited to 'picohttp.c')
-rw-r--r--picohttp.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/picohttp.c b/picohttp.c
index 810fe1b..9b28b92 100644
--- a/picohttp.c
+++ b/picohttp.c
@@ -1124,11 +1124,13 @@ int picohttpMultipartGetch(
if( mp->replayhead < mp->replay ) {
ch = mp->req->query.multipartboundary[mp->replayhead];
mp->replayhead++;
+ debug_printf("replay head: %0.2x\n", ch);
return ch;
} else {
ch = mp->req->query.prev_ch[0];
mp->replay = 0;
mp->replayhead = 0;
+ debug_printf("replay prev: %0.2x\n", ch);
return ch;
}
} else {
@@ -1143,16 +1145,29 @@ int picohttpMultipartGetch(
* a <CR><LF> sequence.
*/
+ switch(ch) {
+ case '\r':
+ debug_printf("(CR)", ch); break;
+ case '\n':
+ debug_printf("(LF)", ch); break;
+ default:
+ debug_printf("(%c)", ch);
+ }
if( '\r' == ch ) {
mp->replayhead =
mp->in_boundary = 0;
- if( '\r' == mp->req->query.prev_ch[1] )
+ if( '\r' == mp->req->query.prev_ch[1] ) {
+ debug_printf("<CR|run>");
return '\r';
+ } else {
+ debug_printf("<CR>");
+ }
} else
if( '\n' == ch &&
'\r' == mp->req->query.prev_ch[1] ) {
mp->replayhead =
mp->in_boundary = 1;
+ debug_printf("<CR><LF>");
} else
if( '-' == ch &&
'\n' == mp->req->query.prev_ch[1] &&
@@ -1160,12 +1175,14 @@ int picohttpMultipartGetch(
) {
mp->replayhead =
mp->in_boundary = 2;
+ debug_printf("<CR><LF>-");
}
while( 0 <= ch ) {
if( mp->req->query.multipartboundary[mp->in_boundary] == ch ) {
if( 0 == mp->req->query.multipartboundary[mp->in_boundary+1] ) {
+ debug_printf("{|}", ch);
mp->in_boundary = 0;
mp->replay = 0;
/* matched boundary */
@@ -1188,8 +1205,10 @@ int picohttpMultipartGetch(
return -1;
}
+ debug_printf("{#}", ch);
mp->in_boundary++;
} else {
+ debug_printf("{_}", ch);
if( mp->in_boundary ) {
/* In case the mismatch was due to a <CR> or <LF>