[Groonga-commit] groonga/groonga [master] httpd: return correct content type

アーカイブの一覧に戻る

null+****@clear***** null+****@clear*****
2012年 6月 22日 (金) 11:59:23 JST


Ryo Onodera	2012-06-22 11:59:23 +0900 (Fri, 22 Jun 2012)

  New Revision: 71ac6328a01513d60d97b5c1f3187d33b2218ae4
  https://github.com/groonga/groonga/commit/71ac6328a01513d60d97b5c1f3187d33b2218ae4

  Log:
    httpd: return correct content type

  Modified files:
    src/nginx-module/ngx_http_groonga_module.c

  Modified: src/nginx-module/ngx_http_groonga_module.c (+3 -3)
===================================================================
--- src/nginx-module/ngx_http_groonga_module.c    2012-06-22 11:58:52 +0900 (ad4ac3f)
+++ src/nginx-module/ngx_http_groonga_module.c    2012-06-22 11:59:23 +0900 (ee7aa37)
@@ -48,8 +48,6 @@ static ngx_command_t ngx_http_groonga_commands[] = {
   ngx_null_command
 };
 
-static const char content_type[] = "application/json";
-
 static void *ngx_http_groonga_create_loc_conf(ngx_conf_t *cf);
 static char *ngx_http_groonga_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child);
 
@@ -139,6 +137,7 @@ ngx_http_groonga_handler(ngx_http_request_t *r)
   unsigned char *body_data;
 
   grn_obj head, body, foot;
+  const char *content_type;
 
   ngx_http_groonga_loc_conf_t *loc_conf;
   loc_conf = ngx_http_get_module_loc_conf(r, ngx_http_groonga_module);
@@ -196,7 +195,8 @@ ngx_http_groonga_handler(ngx_http_request_t *r)
   }
 
   /* set the 'Content-type' header */
-  r->headers_out.content_type.len = sizeof(content_type) - 1;
+  content_type = grn_ctx_get_mime_type(context);
+  r->headers_out.content_type.len = strlen(content_type);
   r->headers_out.content_type.data = (u_char *) content_type;
 
   /* allocate buffers for a response body */
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
ダウンロード 



Groonga-commit メーリングリストの案内
アーカイブの一覧に戻る