Motoi Washida
null+****@clear*****
Sun Aug 18 17:11:55 JST 2013
Motoi Washida 2013-08-18 17:11:55 +0900 (Sun, 18 Aug 2013) New Revision: 0a7272e01840040fa0ab6b709a9cfcfd801fcab2 https://github.com/groonga/groonga/commit/0a7272e01840040fa0ab6b709a9cfcfd801fcab2 Merged 3eb016a: Merge pull request #101 from wm3/httpd-posts-doesnt-work-bug Message: groonga-httpd: support more large POST data Modified files: src/httpd/nginx-module/ngx_http_groonga_module.c Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+12 -4) =================================================================== --- src/httpd/nginx-module/ngx_http_groonga_module.c 2013-08-18 14:59:21 +0900 (0a416fa) +++ src/httpd/nginx-module/ngx_http_groonga_module.c 2013-08-18 17:11:55 +0900 (ee2aa42) @@ -374,6 +374,8 @@ ngx_http_groonga_handler_process_body(ngx_http_request_t *r, grn_ctx *context; ngx_buf_t *body; + u_char *file_contents; + size_t file_size; context = &(data->context); @@ -384,12 +386,18 @@ ngx_http_groonga_handler_process_body(ngx_http_request_t *r, return NGX_HTTP_BAD_REQUEST; } - rc = ngx_http_groonga_send_lines(context, r, body->pos, body->last); - if (rc != NGX_OK) { - return rc; + if (body->file) { + file_size = body->file->offset; + file_contents = ngx_palloc(r->pool, file_size); + rc = ngx_read_file(body->file, file_contents, file_size, 0); + + rc = ngx_http_groonga_send_lines(context, r, file_contents, file_contents + file_size); + ngx_pfree(r->pool, file_contents); + } else { + rc = ngx_http_groonga_send_lines(context, r, body->pos, body->last); } - return NGX_OK; + return rc; } -------------- next part -------------- HTML����������������������������... 下載