Permalink
Browse files

hooked up the chunked parser with the client request body reader for …

…the very first time. extremely short chunked request that can be repread completely by the nginx headers reader is working now :D
  • Loading branch information...
agentzh committed Nov 12, 2009
1 parent f77ee75 commit 7494b128d79c0540179fa6ba9f4fb24d27ec0267
View
22 README
@@ -5,8 +5,8 @@ encoding support for request bodies to nginx 0.8.x and
It's NOT working yet but progressing *very* rapidly. So
go watching it!
-Currently I've already got 411 response caused by chunked
-POST/PUT requests back ;)
+Currently extremely short chunked body that is completely
+preread by the nginx header reader can now be handled.
Usage:
@@ -18,6 +18,24 @@ Usage:
That is, the only directive provided by this module is
"chunkin".
+To build this module with your nginx:
+
+ $ wget 'http://sysoev.ru/nginx/nginx-0.8.24.tar.gz'
+ $ tar -xzvf nginx-0.8.24.tar.gz
+ $ cd nginx-0.8.24/
+
+ # Here we assume you would install you nginx under /opt/nginx/.
+ $ ./configure --prefix=/opt/nginx \
+ --add-module=/path/to/chunkin-nginx-module
+
+ $ make -j2
+ $ make install
+
+The chunked parser is actually written in Ragel. If you want to
+regenerate the parser, use the following command:
+
+ $ ragel -G2 src/chunked_parser.rl
+
Originally spiked by the discussion in this nginx mailing list
thread:
View
4 config
@@ -1,5 +1,5 @@
ngx_addon_name=ngx_http_chunkin_filter_module
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_chunkin_filter_module"
-NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_chunkin_filter_module.c $ngx_addon_dir/src/ngx_http_chunkin_request_body.c"
-NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_chunkin_request_body.h"
+NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_chunkin_filter_module.c $ngx_addon_dir/src/ngx_http_chunkin_request_body.c $ngx_addon_dir/src/chunked_parser.c"
+NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_chunkin_request_body.h $ngx_addon_dir/src/ngx_http_chunkin_filter_module.h $ngx_addon_dir/src/chunked_parser.h"
View
@@ -5,10 +5,11 @@ enum {
BUFSIZE = 256
};
-%% machine foo;
+%% machine chunked;
%% write data;
-int main (int argc, char **argv) {
+int main (int argc, char **argv)
+{
int cs, res = 0;
char *p, *pe, *eof;
char buf[BUFSIZE];
@@ -75,14 +76,14 @@ int main (int argc, char **argv) {
chunk_data = chunk_data_octet* %verify_data;
- chunk = chunk_size space* CRLF
+ chunk = chunk_size " "* CRLF
chunk_data CRLF;
- last_chunk = "0" space* CRLF $err(bad_last_chunk);
+ last_chunk = "0" " "* CRLF ${ fprintf(stderr, "in last chunk %d (cs: %d)\n", p - buf, cs); }; #$err(bad_last_chunk);
- main := chunk*
+ main := (chunk*
last_chunk
- CRLF @{ res = 1; };
+ CRLF) %err{ fprintf(stderr, "in end %d (cs: %d)\n", p - buf, cs); };
}%%
@@ -106,7 +107,7 @@ int main (int argc, char **argv) {
%% write exec;
printf("cs >= first_final: %d, execute = %i, p moved %d, "
- "p remaining: %d\n", cs >= foo_first_final, res, p - buf, pe - p);
+ "p remaining: %d\n", cs >= chunked_first_final, res, p - buf, pe - p);
return 0;
}
Oops, something went wrong.

0 comments on commit 7494b12

Please sign in to comment.