From 77be505fad9fbcea02b27cb89a196b1f230fe42f Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Thu, 20 Jun 2013 21:21:54 +0200 Subject: multipart separation works (almost) --- picohttp.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index a60afd2..7c7997d 100644 --- a/picohttp.h +++ b/picohttp.h @@ -5,7 +5,8 @@ #include #include -#define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 70 +/* max 70 for boundary + 4 chars for "--" */ +#define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 74 #define PICOHTTP_DISPOSITION_NAME_MAX 16 #define PICOHTTP_MAJORVERSION(x) ( (x & 0x7f00) >> 8 ) @@ -16,6 +17,8 @@ #define PICOHTTP_METHOD_POST 3 #define PICOHTTP_CONTENTTYPE_APPLICATION 0x0000 +#define PICOHTTP_CONTENTTYPE_APPLICATION_OCTETSTREAM 0x0000 + #define PICOHTTP_CONTENTTYPE_AUDIO 0x1000 #define PICOHTTP_CONTENTTYPE_IMAGE 0x2000 #define PICOHTTP_CONTENTTYPE_MESSAGE 0x3000 @@ -121,6 +124,7 @@ struct picohttpRequest { uint8_t contentencoding; uint8_t transferencoding; char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; + char prev_ch[3]; } query; struct { char const *contenttype; @@ -143,11 +147,13 @@ struct picohttpRequest { struct picohttpMultipart { struct picohttpRequest *req; + uint8_t finished; uint16_t contenttype; struct { char name[PICOHTTP_DISPOSITION_NAME_MAX+1]; } disposition; - uint8_t boundarymatch_counter; + int in_boundary; + int replay; }; void picohttpProcessRequest( @@ -165,13 +171,13 @@ int picohttpResponseWrite ( size_t len, char const *buf ); -uint16_t picohttpGetch(struct picohttpRequest * const req); +int16_t picohttpGetch(struct picohttpRequest * const req); int picohttpMultipartNext( struct picohttpRequest * const req, struct picohttpMultipart * const mp); -uint16_t picohttpMultipartGetch( +int16_t picohttpMultipartGetch( struct picohttpMultipart * const mp); #endif/*PICOHTTP_H_HEADERGUARD*/ -- cgit v1.2.3