Kouhei Sutou
null+****@clear*****
Mon Oct 14 13:44:24 JST 2013
Kouhei Sutou 2013-10-14 13:44:24 +0900 (Mon, 14 Oct 2013) New Revision: dd7fab4b3bedc921e680c6e5a50f27812c1dc367 https://github.com/groonga/groonga/commit/dd7fab4b3bedc921e680c6e5a50f27812c1dc367 Message: http: return "400 Bad Request" for invalid argument error Modified files: src/groonga.c Modified: src/groonga.c (+8 -2) =================================================================== --- src/groonga.c 2013-10-14 11:10:26 +0900 (6613c6b) +++ src/groonga.c 2013-10-14 13:44:24 +0900 (78819ca) @@ -672,10 +672,16 @@ h_output(grn_ctx *ctx, int flags, void *arg) } else { GRN_BULK_REWIND(outbuf); output_envelope(ctx, expr_rc, &head, outbuf, &foot); - if (expr_rc == GRN_NO_SUCH_FILE_OR_DIRECTORY) { + switch (expr_rc) { + case GRN_INVALID_ARGUMENT : + GRN_TEXT_SETS(ctx, body, "HTTP/1.1 400 Bad Request\r\n"); + break; + case GRN_NO_SUCH_FILE_OR_DIRECTORY : GRN_TEXT_SETS(ctx, body, "HTTP/1.1 404 Not Found\r\n"); - } else { + break; + default : GRN_TEXT_SETS(ctx, body, "HTTP/1.1 500 Internal Server Error\r\n"); + break; } GRN_TEXT_PUTS(ctx, body, "Content-Type: "); GRN_TEXT_PUTS(ctx, body, grn_ctx_get_mime_type(ctx)); -------------- next part -------------- HTML����������������������������...Download