[Groonga-commit] groonga/groonga at 8b51d75 [master] groonga-httpd: use application/javascript for JSONP

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Sep 27 14:36:45 JST 2016


Kouhei Sutou	2016-09-27 14:36:45 +0900 (Tue, 27 Sep 2016)

  New Revision: 8b51d75edbb902e341a5e3c8bd9d9c132f1bbb4c
  https://github.com/groonga/groonga/commit/8b51d75edbb902e341a5e3c8bd9d9c132f1bbb4c

  Message:
    groonga-httpd: use application/javascript for JSONP

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

  Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+8 -1)
===================================================================
--- src/httpd/nginx-module/ngx_http_groonga_module.c    2016-09-27 14:30:03 +0900 (2fb413c)
+++ src/httpd/nginx-module/ngx_http_groonga_module.c    2016-09-27 14:36:45 +0900 (20a739e)
@@ -935,7 +935,14 @@ ngx_http_groonga_handler_send_response(ngx_http_request_t *r,
 
   /* set the 'Content-type' header */
   if (r->headers_out.content_type.len == 0) {
-    content_type = grn_ctx_get_mime_type(context);
+    grn_obj *foot = &(data->typed.foot);
+    if (grn_ctx_get_output_type(context) == GRN_CONTENT_JSON &&
+        GRN_TEXT_LEN(foot) > 0 &&
+        GRN_TEXT_VALUE(foot)[GRN_TEXT_LEN(foot) - 1] == ';') {
+      content_type = "application/javascript";
+    } else {
+      content_type = grn_ctx_get_mime_type(context);
+    }
     ngx_http_groonga_handler_set_content_type(r, content_type);
   }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index