[Groonga-commit] groonga/groonga [master] Define grn_output_type

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 19日 (火) 11:00:07 JST


Ryo Onodera	2012-06-19 11:00:07 +0900 (Tue, 19 Jun 2012)

  New Revision: c2cb357b7848ebeafb10e448cbc961d731d31d15
  https://github.com/groonga/groonga/commit/c2cb357b7848ebeafb10e448cbc961d731d31d15

  Merged 51cdeee: Merge pull request #15 from ryoqun/grn-output-type

  Log:
    Define grn_output_type

  Modified files:
    include/groonga.h
    lib/output.c
    src/groonga.c

  Modified: include/groonga.h (+1 -0)
===================================================================
--- include/groonga.h    2012-06-19 10:12:00 +0900 (f9b3223)
+++ include/groonga.h    2012-06-19 11:00:07 +0900 (bd2b9da)
@@ -2146,6 +2146,7 @@ GRN_API void grn_output_obj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type outp
 GRN_API void grn_output_envelope(grn_ctx *ctx, grn_rc rc,
                                  grn_obj *head, grn_obj *body, grn_obj *foot,
                                  const char *file, int line);
+GRN_API const char *grn_output_type(grn_ctx *ctx);
 
 /* obsolete */
 GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,

  Modified: lib/output.c (+6 -0)
===================================================================
--- lib/output.c    2012-06-19 10:12:00 +0900 (25089b7)
+++ lib/output.c    2012-06-19 11:00:07 +0900 (f0ab088)
@@ -1499,3 +1499,9 @@ grn_output_envelope(grn_ctx *ctx,
     break;
   }
 }
+
+const char *
+grn_output_type(grn_ctx *ctx)
+{
+  return ctx->impl->mime_type;
+}

  Modified: src/groonga.c (+2 -3)
===================================================================
--- src/groonga.c    2012-06-19 10:12:00 +0900 (b9c009d)
+++ src/groonga.c    2012-06-19 11:00:07 +0900 (9801aea)
@@ -550,7 +550,6 @@ h_output(grn_ctx *ctx, int flags, void *arg)
   ht_context *hc = (ht_context *)arg;
   grn_sock fd = hc->msg->u.fd;
   grn_obj *body = &hc->body;
-  const char *mime_type = ctx->impl->mime_type;
   grn_obj head, foot, *outbuf = ctx->impl->outbuf;
   if (!(flags & GRN_CTX_TAIL)) { return; }
   GRN_TEXT_INIT(&head, 0);
@@ -573,7 +572,7 @@ h_output(grn_ctx *ctx, int flags, void *arg)
     GRN_TEXT_SETS(ctx, body, "HTTP/1.1 200 OK\r\n");
     GRN_TEXT_PUTS(ctx, body, "Connection: close\r\n");
     GRN_TEXT_PUTS(ctx, body, "Content-Type: ");
-    GRN_TEXT_PUTS(ctx, body, mime_type);
+    GRN_TEXT_PUTS(ctx, body, grn_output_type(ctx));
     GRN_TEXT_PUTS(ctx, body, "\r\nContent-Length: ");
     grn_text_lltoa(ctx, body,
                    GRN_TEXT_LEN(&head) + GRN_TEXT_LEN(outbuf) + GRN_TEXT_LEN(&foot));
@@ -587,7 +586,7 @@ h_output(grn_ctx *ctx, int flags, void *arg)
       GRN_TEXT_SETS(ctx, body, "HTTP/1.1 500 Internal Server Error\r\n");
     }
     GRN_TEXT_PUTS(ctx, body, "Content-Type: ");
-    GRN_TEXT_PUTS(ctx, body, mime_type);
+    GRN_TEXT_PUTS(ctx, body, grn_output_type(ctx));
     GRN_TEXT_PUTS(ctx, body, "\r\n\r\n");
   }
   {
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index