[Groonga-commit] groonga/groonga at 819e032 [master] httpd: (may) fix build error on clang

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 14 21:30:59 JST 2014


Kouhei Sutou	2014-07-14 21:30:59 +0900 (Mon, 14 Jul 2014)

  New Revision: 819e032d496201903139e47da05c3c46b788c249
  https://github.com/groonga/groonga/commit/819e032d496201903139e47da05c3c46b788c249

  Message:
    httpd: (may) fix build error on clang
    
    GitHub: fix clear-code/rurema-search#14
    
    Reported by niku. Thanks!!!

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

  Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+26 -5)
===================================================================
--- src/httpd/nginx-module/ngx_http_groonga_module.c    2014-07-14 00:08:17 +0900 (27f693a)
+++ src/httpd/nginx-module/ngx_http_groonga_module.c    2014-07-14 21:30:59 +0900 (cf7cf79)
@@ -829,18 +829,39 @@ ngx_http_groonga_handler_get(ngx_http_request_t *r)
 }
 
 static void
+ngx_http_groonga_handler_post_send_error_response(ngx_http_request_t *r,
+                                                  ngx_int_t rc)
+{
+  r->headers_out.status = rc;
+  r->headers_out.content_length_n = 0;
+  r->header_only = 1;
+  rc = ngx_http_send_header(r);
+  ngx_http_finalize_request(r, rc);
+}
+
+static void
 ngx_http_groonga_handler_post(ngx_http_request_t *r)
 {
   ngx_int_t rc;
   ngx_str_t command_path;
-  ngx_http_groonga_handler_data_t *data;
+  ngx_http_groonga_handler_data_t *data = NULL;
 
   rc = ngx_http_groonga_extract_command_path(r, &command_path);
-  if (rc == NGX_OK) {
-    rc = ngx_http_groonga_handler_create_data(r, &data);
+  if (rc != NGX_OK) {
+    ngx_http_groonga_handler_post_send_error_response(r, rc);
+    return;
   }
-  if (rc == NGX_OK) {
-    rc = ngx_http_groonga_handler_process_load(r, &command_path, data);
+
+  rc = ngx_http_groonga_handler_create_data(r, &data);
+  if (rc != NGX_OK) {
+    ngx_http_groonga_handler_post_send_error_response(r, rc);
+    return;
+  }
+
+  rc = ngx_http_groonga_handler_process_load(r, &command_path, data);
+  if (rc != NGX_OK) {
+    ngx_http_groonga_handler_post_send_error_response(r, rc);
+    return;
   }
 
   ngx_http_groonga_handler_send_response(r, data);
-------------- next part --------------
HTML����������������������������...
Download 



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