aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de>2013-06-20 16:55:32 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de>2013-06-20 16:55:32 +0200
commit9de2c281d9a4c350754ceb02c6f4a65134d007ee (patch)
treee1a35887689f74f4720e28544ce76d8fb03d74b9
parentef400acf33b32092c6c4c76f91a44d0a38061d0f (diff)
parent21ac350ef7d59e88dd0ee725cdd94edbfdfcb7d6 (diff)
downloadlitheweb-9de2c281d9a4c350754ceb02c6f4a65134d007ee.tar.gz
litheweb-9de2c281d9a4c350754ceb02c6f4a65134d007ee.tar.bz2
Merge branch 'master' of mhzoctdev.maiman:/srv/git/mhzoct/picoweb
-rw-r--r--picohttp.c51
-rw-r--r--picohttp.h4
2 files changed, 52 insertions, 3 deletions
diff --git a/picohttp.c b/picohttp.c
index 957bfa6..2cd18a6 100644
--- a/picohttp.c
+++ b/picohttp.c
@@ -225,6 +225,13 @@ static int16_t picohttpIoGetPercentCh(
return ch;
}
+uint16_t picohttpGetch(struct picohttpRequest * const req)
+{
+ /* read HTTP query body, skipping over Chunked Transfer Boundaries
+ * if Chunked Transfer Encoding is used */
+
+}
+
/* TODO:
* It is possible to do in-place pattern matching on the route definition
* array, without first reading in the URL and then processing it here.
@@ -888,3 +895,47 @@ int picohttpResponseWrite (
return len;
}
+uint16_t picohttpMultipartGetch(
+ struct picohttpMultiPart * const mp);
+{
+ if( mp->replay + mp->in_boundary < 0) {
+ uint16_t ch = mp->replay < 1 ? '-' :
+ mp->req->query.multipartboundary[mp->replay - 1];
+ mp->replay++;
+ return ch;
+ } else if( mp->finished) {
+ return -1;
+ } else {
+ uint16_t ch;
+ ch = picohttpIoGetch(mp->req->ioops);
+ if( 0 > ch ) {
+ return ch;
+ }
+
+ if( (0 == mp->in_boundary && '\r' == ch) ||
+ (1 == mp->in_boundary && '\n' == ch) ||
+ (2 < mp->in_boundary && '-' == ch) ||
+ (4 < mp->in_boundary &&
+ mp->req->query.multipartboundary[mp->in_boundary-4] == ch) ) {
+ if( 5 < mp->in_boundary &&
+ 0 == mp->req->query.multipartboundary[mp->in_boundary-3] ) {
+ /* matched boundary */
+ mp->finished = 1;
+ return 0;
+ }
+ mp->in_boundary++;
+ ch = picohttpIoGetch(mp->req->ioops);
+ if( 0 >= ch ) {
+ return -1;
+ }
+ } else {
+ mp->replay = mp->in_boundary + 1;
+ return '-';
+ }
+ }
+}
+
+
+
+
+
diff --git a/picohttp.h b/picohttp.h
index 76253b0..a60afd2 100644
--- a/picohttp.h
+++ b/picohttp.h
@@ -165,9 +165,7 @@ int picohttpResponseWrite (
size_t len,
char const *buf );
-uint16_t picohttpGetch(
- struct picohttpRequest * const req,
- struct picohttpChunkTransfer * const ct);
+uint16_t picohttpGetch(struct picohttpRequest * const req);
int picohttpMultipartNext(
struct picohttpRequest * const req,