[Groonga-commit] groonga/groonga [master] groonga-httpd: extract GET/HEAD handler

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Sep 6 17:26:21 JST 2012


Kouhei Sutou	2012-09-06 17:26:21 +0900 (Thu, 06 Sep 2012)

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

  Log:
    groonga-httpd: extract GET/HEAD handler

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

  Modified: src/nginx-module/ngx_http_groonga_module.c (+19 -6)
===================================================================
--- src/nginx-module/ngx_http_groonga_module.c    2012-09-06 17:21:59 +0900 (7116c38)
+++ src/nginx-module/ngx_http_groonga_module.c    2012-09-06 17:26:21 +0900 (ce61250)
@@ -371,17 +371,12 @@ ngx_http_groonga_handler_send_response(ngx_http_request_t *r,
 }
 
 static ngx_int_t
-ngx_http_groonga_handler(ngx_http_request_t *r)
+ngx_http_groonga_handler_get(ngx_http_request_t *r)
 {
   ngx_int_t rc;
   ngx_str_t command_path;
   ngx_http_groonga_handler_data_t *data;
 
-  /* we respond to 'GET' and 'HEAD' requests only */
-  if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
-    return NGX_HTTP_NOT_ALLOWED;
-  }
-
   rc = ngx_http_groonga_extract_command_path(r, &command_path);
   if (rc != NGX_OK) {
     return rc;
@@ -408,6 +403,24 @@ ngx_http_groonga_handler(ngx_http_request_t *r)
   return rc;
 }
 
+static ngx_int_t
+ngx_http_groonga_handler(ngx_http_request_t *r)
+{
+  ngx_int_t rc;
+
+  switch (r->method) {
+  case NGX_HTTP_GET:
+  case NGX_HTTP_HEAD:
+    rc = ngx_http_groonga_handler_get(r);
+    break;
+  default:
+    rc = NGX_HTTP_NOT_ALLOWED;
+    break;
+  }
+
+  return rc;
+}
+
 static char *
 ngx_http_groonga_conf_set_groonga_slot(ngx_conf_t *cf, ngx_command_t *cmd,
                                        void *conf)
-------------- next part --------------
HTML����������������������������...
Download 



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