From 660e0aaecd654c0ed99001cd765693dc9fb8a66d Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 23 Apr 2013 17:12:22 +0200 Subject: Tue Apr 23 17:12:22 CEST 2013 --- picohttp.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 041f124..6041935 100644 --- a/picohttp.h +++ b/picohttp.h @@ -79,6 +79,17 @@ struct picohttpURLRoute { int16_t allowed_methods; }; +#define PICOHTTP_EPOCH_YEAR 1980 + +struct picohttpDateTime { + unsigned int Y:7; /* EPOCH + 127 years */ + unsigned int M:4; + unsigned int D:5; + unsigned int h:5; + unsigned int m:6; + unsigned int s:5; /* seconds / 2 */ +}; + struct picohttpRequest { struct picohttpIoOps const * ioops; struct picohttpURLRoute const * route; @@ -99,9 +110,9 @@ struct picohttpRequest { } query; struct { char const *contenttype; - char const *date; - char const *cachecontrol; char const *disposition; + struct picohttpDateTime lastmodified; + uint16_t max_age; size_t contentlength; uint8_t contentencoding; uint8_t transferencoding; -- cgit v1.2.3 From 813d72a2d1a4305811b39607828a9f49daadb2ab Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 18 Jun 2013 00:53:25 +0200 Subject: Added API declarations for Chunked Tranfer transport and Multipart Encoding support. --- picohttp.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 041f124..d94172b 100644 --- a/picohttp.h +++ b/picohttp.h @@ -127,4 +127,15 @@ int picohttpResponseWrite ( size_t len, char const *buf ); +uint16_t picohttpGetch( + struct picohttpRequest * const req, + struct picohttpChunkTransfer * const ct); + +int picohttpMultipartNext( + struct picohttpRequest * const req, + struct picohttpMultiPart * const mp); + +uint16_t picohttpMultipartGetch( + struct picohttpMultiPart * const mp); + #endif/*PICOHTTP_H_HEADERGUARD*/ -- cgit v1.2.3 From fc9f3c0bde26bc882bdfe1ec0435ade8b60172f4 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 18 Jun 2013 00:55:27 +0200 Subject: Epoch for datetime struct changed to 1970 --- picohttp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 95ac0e7..803587d 100644 --- a/picohttp.h +++ b/picohttp.h @@ -79,7 +79,7 @@ struct picohttpURLRoute { int16_t allowed_methods; }; -#define PICOHTTP_EPOCH_YEAR 1980 +#define PICOHTTP_EPOCH_YEAR 1970 struct picohttpDateTime { unsigned int Y:7; /* EPOCH + 127 years */ -- cgit v1.2.3 From 47e13329da36b76918d44d51be78ef9e5584fcc0 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 18 Jun 2013 20:10:12 +0200 Subject: Header Line separation implemented --- picohttp.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 041f124..831e1b0 100644 --- a/picohttp.h +++ b/picohttp.h @@ -5,6 +5,8 @@ #include #include +#define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 70 + #define PICOHTTP_MAJORVERSION(x) ( (x & 0x7f00) >> 8 ) #define PICOHTTP_MINORVERSION(x) ( (x & 0x007f) ) @@ -12,6 +14,21 @@ #define PICOHTTP_METHOD_HEAD 2 #define PICOHTTP_METHOD_POST 3 +#define PICOHTTP_CONTENTTYPE_APPLICATION 0 +#define PICOHTTP_CONTENTTYPE_AUDIO 1 +#define PICOHTTP_CONTENTTYPE_IMAGE 2 +#define PICOHTTP_CONTENTTYPE_MESSAGE 3 +#define PICOHTTP_CONTENTTYPE_MODEL 4 +#define PICOHTTP_CONTENTTYPE_MULTIPART 5 +#define PICOHTTP_CONTENTTYPE_TEXT 6 +#define PICOHTTP_CONTENTTYPE_VIDEO 7 + +#define PICOHTTP_CONTENTTYPE_TEXT_SUBTYPE_CSV 3 +#define PICOHTTP_CONTENTTYPE_TEXT_SUBTYPE_HTML 4 +#define PICOHTTP_CONTENTTYPE_TEXT_SUBTYPE_PLAIN 6 + +#define PICOHTTP_CONTENTTYPE_MULTIPART_SUBTYPE_FORM_DATA 4 + #define PICOHTTP_CODING_IDENTITY 0 #define PICOHTTP_CODING_COMPRESS 1 #define PICOHTTP_CODING_DEFLATE 2 @@ -92,10 +109,14 @@ struct picohttpRequest { uint8_t minor; } httpversion; struct { - char const *contenttype; + struct { + uint16_t type:4; + uint16_t subtype:12; + } contenttype; size_t contentlength; - uint8_t contentcoding; + uint8_t contentencoding; uint8_t te; + char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; } query; struct { char const *contenttype; -- cgit v1.2.3 From c50c12e6206772273f62752c1c0091ac78698665 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 18 Jun 2013 21:24:59 +0200 Subject: added header processing for content type and transfer encoding - chunked --- picohttp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index ced2ef5..34fc59b 100644 --- a/picohttp.h +++ b/picohttp.h @@ -126,7 +126,7 @@ struct picohttpRequest { } contenttype; size_t contentlength; uint8_t contentencoding; - uint8_t te; + uint8_t transferencoding; char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; } query; struct { @@ -138,6 +138,9 @@ struct picohttpRequest { uint8_t contentencoding; uint8_t transferencoding; } response; + struct { + size_t length; + } currentchunk; struct { size_t octets; uint8_t header; -- cgit v1.2.3 From e7b86baeec0ef6f946e2b60a68876eb6f3cdc32e Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 18 Jun 2013 22:14:52 +0200 Subject: ... --- picohttp.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 803587d..24212e5 100644 --- a/picohttp.h +++ b/picohttp.h @@ -138,9 +138,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, -- cgit v1.2.3 From ef400acf33b32092c6c4c76f91a44d0a38061d0f Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Thu, 20 Jun 2013 16:55:28 +0200 Subject: ... --- picohttp.h | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 34fc59b..76253b0 100644 --- a/picohttp.h +++ b/picohttp.h @@ -6,6 +6,7 @@ #include #define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 70 +#define PICOHTTP_DISPOSITION_NAME_MAX 16 #define PICOHTTP_MAJORVERSION(x) ( (x & 0x7f00) >> 8 ) #define PICOHTTP_MINORVERSION(x) ( (x & 0x007f) ) @@ -14,20 +15,21 @@ #define PICOHTTP_METHOD_HEAD 2 #define PICOHTTP_METHOD_POST 3 -#define PICOHTTP_CONTENTTYPE_APPLICATION 0 -#define PICOHTTP_CONTENTTYPE_AUDIO 1 -#define PICOHTTP_CONTENTTYPE_IMAGE 2 -#define PICOHTTP_CONTENTTYPE_MESSAGE 3 -#define PICOHTTP_CONTENTTYPE_MODEL 4 -#define PICOHTTP_CONTENTTYPE_MULTIPART 5 -#define PICOHTTP_CONTENTTYPE_TEXT 6 -#define PICOHTTP_CONTENTTYPE_VIDEO 7 +#define PICOHTTP_CONTENTTYPE_APPLICATION 0x0000 +#define PICOHTTP_CONTENTTYPE_AUDIO 0x1000 +#define PICOHTTP_CONTENTTYPE_IMAGE 0x2000 +#define PICOHTTP_CONTENTTYPE_MESSAGE 0x3000 +#define PICOHTTP_CONTENTTYPE_MODEL 0x4000 -#define PICOHTTP_CONTENTTYPE_TEXT_SUBTYPE_CSV 3 -#define PICOHTTP_CONTENTTYPE_TEXT_SUBTYPE_HTML 4 -#define PICOHTTP_CONTENTTYPE_TEXT_SUBTYPE_PLAIN 6 +#define PICOHTTP_CONTENTTYPE_MULTIPART 0x5000 +#define PICOHTTP_CONTENTTYPE_MULTIPART_FORMDATA 0x5004 -#define PICOHTTP_CONTENTTYPE_MULTIPART_SUBTYPE_FORM_DATA 4 +#define PICOHTTP_CONTENTTYPE_TEXT 0x6000 +#define PICOHTTP_CONTENTTYPE_TEXT_CSV 0x6003 +#define PICOHTTP_CONTENTTYPE_TEXT_HTML 0x6004 +#define PICOHTTP_CONTENTTYPE_TEXT_PLAIN 0x6006 + +#define PICOHTTP_CONTENTTYPE_VIDEO 0x7000 #define PICOHTTP_CODING_IDENTITY 0 #define PICOHTTP_CODING_COMPRESS 1 @@ -53,12 +55,6 @@ struct picohttpIoOps { void *data; }; -#define picohttpIoWrite(ioops,size,buf) (ioops->write(size, buf, ioops->data)) -#define picohttpIoRead(ioops,size,buf) (ioops->read(size, buf, ioops->data)) -#define picohttpIoGetch(ioops) (ioops->getch(ioops->data)) -#define picohttpIoPutch(ioops,c) (ioops->putch(c, ioops->data)) -#define picohttpIoFlush(ioops) (ioops->flush(ioops->data)) - enum picohttpVarType { PICOHTTP_TYPE_UNDEFINED = 0, PICOHTTP_TYPE_INTEGER = 1, @@ -120,10 +116,7 @@ struct picohttpRequest { uint8_t minor; } httpversion; struct { - struct { - uint16_t type:4; - uint16_t subtype:12; - } contenttype; + uint16_t contenttype; size_t contentlength; uint8_t contentencoding; uint8_t transferencoding; @@ -141,12 +134,22 @@ struct picohttpRequest { struct { size_t length; } currentchunk; + size_t received_octets; struct { size_t octets; uint8_t header; } sent; }; +struct picohttpMultipart { + struct picohttpRequest *req; + uint16_t contenttype; + struct { + char name[PICOHTTP_DISPOSITION_NAME_MAX+1]; + } disposition; + uint8_t boundarymatch_counter; +}; + void picohttpProcessRequest( struct picohttpIoOps const * const ioops, struct picohttpURLRoute const * const routes ); @@ -168,9 +171,9 @@ uint16_t picohttpGetch( int picohttpMultipartNext( struct picohttpRequest * const req, - struct picohttpMultiPart * const mp); + struct picohttpMultipart * const mp); uint16_t picohttpMultipartGetch( - struct picohttpMultiPart * const mp); + struct picohttpMultipart * const mp); #endif/*PICOHTTP_H_HEADERGUARD*/ -- cgit v1.2.3 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 From 2c6b42c55b3db99c664de543f32f2434948c5916 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 25 Jun 2013 15:01:24 +0200 Subject: still superfluous at end of multipart block --- picohttp.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 7c7997d..e3aa8a3 100644 --- a/picohttp.h +++ b/picohttp.h @@ -154,8 +154,14 @@ struct picohttpMultipart { } disposition; int in_boundary; int replay; + int replayhead; }; +typedef void (*picohttpHeaderFieldCallback)( + struct picohttpRequest *req, + char const *headername, + char const *headervalue); + void picohttpProcessRequest( struct picohttpIoOps const * const ioops, struct picohttpURLRoute const * const routes ); -- cgit v1.2.3 From 1fb50bb9c2c971691a93a844a1c3e6b84cdcca31 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 25 Jun 2013 16:06:55 +0200 Subject: still superfluous at end of multipart block --- picohttp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index e3aa8a3..faa54de 100644 --- a/picohttp.h +++ b/picohttp.h @@ -5,8 +5,8 @@ #include #include -/* max 70 for boundary + 4 chars for "--" */ -#define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 74 +/* max 70 for boundary + 6 chars for "--" */ +#define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 76 #define PICOHTTP_DISPOSITION_NAME_MAX 16 #define PICOHTTP_MAJORVERSION(x) ( (x & 0x7f00) >> 8 ) @@ -124,7 +124,7 @@ struct picohttpRequest { uint8_t contentencoding; uint8_t transferencoding; char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; - char prev_ch[3]; + char prev_ch[5]; } query; struct { char const *contenttype; -- cgit v1.2.3 From ffa2fc800d92b40f4a128814ae55b121a7852e58 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Wed, 26 Jun 2013 19:34:04 +0200 Subject: *grrr* last two days completely wasted because text editors fooled me by not showing CR and LF present and things I thought to be artifacts are actual data. At least I could fix it easily. --- picohttp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index faa54de..d7bccde 100644 --- a/picohttp.h +++ b/picohttp.h @@ -5,8 +5,8 @@ #include #include -/* max 70 for boundary + 6 chars for "--" */ -#define PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN 76 +/* 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 ) -- cgit v1.2.3 From f9cc5128f5e9eb726b8562d33067ddce6d65385c Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 28 Jun 2013 18:14:16 +0200 Subject: multipart code works --- picohttp.h | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index d7bccde..063ebd5 100644 --- a/picohttp.h +++ b/picohttp.h @@ -7,32 +7,29 @@ /* 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 ) -#define PICOHTTP_MINORVERSION(x) ( (x & 0x007f) ) +#define PICOHTTP_DISPOSITION_NAME_MAX 48 #define PICOHTTP_METHOD_GET 1 #define PICOHTTP_METHOD_HEAD 2 -#define PICOHTTP_METHOD_POST 3 +#define PICOHTTP_METHOD_POST 4 -#define PICOHTTP_CONTENTTYPE_APPLICATION 0x0000 -#define PICOHTTP_CONTENTTYPE_APPLICATION_OCTETSTREAM 0x0000 +#define PICOHTTP_CONTENTTYPE_APPLICATION 0x1000 +#define PICOHTTP_CONTENTTYPE_APPLICATION_OCTETSTREAM 0x1000 -#define PICOHTTP_CONTENTTYPE_AUDIO 0x1000 -#define PICOHTTP_CONTENTTYPE_IMAGE 0x2000 -#define PICOHTTP_CONTENTTYPE_MESSAGE 0x3000 -#define PICOHTTP_CONTENTTYPE_MODEL 0x4000 +#define PICOHTTP_CONTENTTYPE_AUDIO 0x2000 +#define PICOHTTP_CONTENTTYPE_IMAGE 0x3000 +#define PICOHTTP_CONTENTTYPE_MESSAGE 0x4000 +#define PICOHTTP_CONTENTTYPE_MODEL 0x5000 -#define PICOHTTP_CONTENTTYPE_MULTIPART 0x5000 -#define PICOHTTP_CONTENTTYPE_MULTIPART_FORMDATA 0x5004 +#define PICOHTTP_CONTENTTYPE_MULTIPART 0x6000 +#define PICOHTTP_CONTENTTYPE_MULTIPART_FORMDATA 0x6004 -#define PICOHTTP_CONTENTTYPE_TEXT 0x6000 -#define PICOHTTP_CONTENTTYPE_TEXT_CSV 0x6003 -#define PICOHTTP_CONTENTTYPE_TEXT_HTML 0x6004 -#define PICOHTTP_CONTENTTYPE_TEXT_PLAIN 0x6006 +#define PICOHTTP_CONTENTTYPE_TEXT 0x7000 +#define PICOHTTP_CONTENTTYPE_TEXT_CSV 0x7003 +#define PICOHTTP_CONTENTTYPE_TEXT_HTML 0x7004 +#define PICOHTTP_CONTENTTYPE_TEXT_PLAIN 0x7006 -#define PICOHTTP_CONTENTTYPE_VIDEO 0x7000 +#define PICOHTTP_CONTENTTYPE_VIDEO 0x8000 #define PICOHTTP_CODING_IDENTITY 0 #define PICOHTTP_CODING_COMPRESS 1 @@ -52,7 +49,7 @@ struct picohttpIoOps { int (*read)(size_t /*count*/, char* /*buf*/, void*); int (*write)(size_t /*count*/, char const* /*buf*/, void*); - int16_t (*getch)(void*); // returns -1 on error + int16_t (*getch)(void*); // returns negative value on error int (*putch)(char, void*); int (*flush)(void*); void *data; @@ -158,7 +155,7 @@ struct picohttpMultipart { }; typedef void (*picohttpHeaderFieldCallback)( - struct picohttpRequest *req, + void * const data, char const *headername, char const *headervalue); @@ -179,11 +176,18 @@ int picohttpResponseWrite ( int16_t picohttpGetch(struct picohttpRequest * const req); +struct picohttpMultipart picohttpMultipartStart( + struct picohttpRequest * const req); + int picohttpMultipartNext( - struct picohttpRequest * const req, struct picohttpMultipart * const mp); int16_t picohttpMultipartGetch( struct picohttpMultipart * const mp); +int picohttpMultipartRead( + struct picohttpMultipart * const mp, + size_t len, + char * const buf); + #endif/*PICOHTTP_H_HEADERGUARD*/ -- cgit v1.2.3 From ac9f95a91345561704c667ea387ee5efb2c67a8f Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 28 Jun 2013 20:41:42 +0200 Subject: chunked transfer getch done --- picohttp.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 063ebd5..8afa022 100644 --- a/picohttp.h +++ b/picohttp.h @@ -122,6 +122,7 @@ struct picohttpRequest { uint8_t transferencoding; char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; char prev_ch[5]; + size_t chunklength; } query; struct { char const *contenttype; @@ -132,9 +133,6 @@ struct picohttpRequest { uint8_t contentencoding; uint8_t transferencoding; } response; - struct { - size_t length; - } currentchunk; size_t received_octets; struct { size_t octets; -- cgit v1.2.3 From bee3c22a9a5156fe6a2b7f4a26b4d4f20cb7d8f1 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Thu, 18 Jul 2013 13:36:39 +0200 Subject: multipart boundary handling breaks with CR CR ... CR runs --- picohttp.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 8afa022..380584c 100644 --- a/picohttp.h +++ b/picohttp.h @@ -49,7 +49,7 @@ struct picohttpIoOps { int (*read)(size_t /*count*/, char* /*buf*/, void*); int (*write)(size_t /*count*/, char const* /*buf*/, void*); - int16_t (*getch)(void*); // returns negative value on error + int (*getch)(void*); // returns negative value on error int (*putch)(char, void*); int (*flush)(void*); void *data; @@ -88,8 +88,8 @@ struct picohttpURLRoute { char const * urlhead; struct picohttpVarSpec const * get_vars; picohttpHandler handler; - uint16_t max_urltail_len; - int16_t allowed_methods; + unsigned int max_urltail_len; + int allowed_methods; }; #define PICOHTTP_EPOCH_YEAR 1970 @@ -109,14 +109,14 @@ struct picohttpRequest { struct picohttpVar *get_vars; char *url; char *urltail; - int16_t status; - int16_t method; + int status; + int method; struct { uint8_t major; uint8_t minor; } httpversion; struct { - uint16_t contenttype; + int contenttype; size_t contentlength; uint8_t contentencoding; uint8_t transferencoding; @@ -128,7 +128,7 @@ struct picohttpRequest { char const *contenttype; char const *disposition; struct picohttpDateTime lastmodified; - uint16_t max_age; + int max_age; size_t contentlength; uint8_t contentencoding; uint8_t transferencoding; @@ -143,7 +143,7 @@ struct picohttpRequest { struct picohttpMultipart { struct picohttpRequest *req; uint8_t finished; - uint16_t contenttype; + int contenttype; struct { char name[PICOHTTP_DISPOSITION_NAME_MAX+1]; } disposition; @@ -162,7 +162,7 @@ void picohttpProcessRequest( struct picohttpURLRoute const * const routes ); void picohttpStatusResponse( - struct picohttpRequest *req, int16_t status ); + struct picohttpRequest *req, int status ); int picohttpResponseSendHeader ( struct picohttpRequest * const req ); @@ -172,7 +172,7 @@ int picohttpResponseWrite ( size_t len, char const *buf ); -int16_t picohttpGetch(struct picohttpRequest * const req); +int picohttpGetch(struct picohttpRequest * const req); struct picohttpMultipart picohttpMultipartStart( struct picohttpRequest * const req); @@ -180,7 +180,7 @@ struct picohttpMultipart picohttpMultipartStart( int picohttpMultipartNext( struct picohttpMultipart * const mp); -int16_t picohttpMultipartGetch( +int picohttpMultipartGetch( struct picohttpMultipart * const mp); int picohttpMultipartRead( -- cgit v1.2.3 From 9689e87ed54246598b154750aa2afc1735283ba7 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 19 Jul 2013 14:24:02 +0200 Subject: multipart boundary separation totally broken with runs of s; I must approach this differently. --- picohttp.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index 380584c..d3931ab 100644 --- a/picohttp.h +++ b/picohttp.h @@ -47,10 +47,10 @@ #define PICOHTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED 505 struct picohttpIoOps { - int (*read)(size_t /*count*/, char* /*buf*/, void*); - int (*write)(size_t /*count*/, char const* /*buf*/, void*); + int (*read)(size_t /*count*/, void* /*buf*/, void*); + int (*write)(size_t /*count*/, void const* /*buf*/, void*); int (*getch)(void*); // returns negative value on error - int (*putch)(char, void*); + int (*putch)(int, void*); int (*flush)(void*); void *data; }; @@ -120,8 +120,8 @@ struct picohttpRequest { size_t contentlength; uint8_t contentencoding; uint8_t transferencoding; - char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; - char prev_ch[5]; + unsigned char multipartboundary[PICOHTTP_MULTIPARTBOUNDARY_MAX_LEN+1]; + unsigned char prev_ch[5]; size_t chunklength; } query; struct { -- cgit v1.2.3 From d62d604877249f1eeaf920b3f149eb906b24cd16 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 19 Jul 2013 17:32:21 +0200 Subject: multipart seems to work (finally) --- picohttp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'picohttp.h') diff --git a/picohttp.h b/picohttp.h index d3931ab..59e792e 100644 --- a/picohttp.h +++ b/picohttp.h @@ -150,6 +150,7 @@ struct picohttpMultipart { int in_boundary; int replay; int replayhead; + int mismatch; }; typedef void (*picohttpHeaderFieldCallback)( -- cgit v1.2.3