Signed-off-by: Liu Yuan <[email protected]>
---
 sheep/http/http.c |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/sheep/http/http.c b/sheep/http/http.c
index 644cdc5..e9afedc 100644
--- a/sheep/http/http.c
+++ b/sheep/http/http.c
@@ -209,37 +209,27 @@ static void http_run_request(struct work *work)
        struct http_driver *hdrv;
 
        list_for_each_entry(hdrv, &http_enabled_drivers, list) {
-               void (*method)(struct http_request *req) = NULL;
-
                switch (op) {
                case HTTP_HEAD:
-                       method = hdrv->head;
+                       hdrv->head(req);
                        break;
                case HTTP_GET:
-                       method = hdrv->get;
+                       hdrv->get(req);
                        break;
                case HTTP_PUT:
-                       method = hdrv->put;
+                       hdrv->put(req);
                        break;
                case HTTP_POST:
-                       method = hdrv->post;
+                       hdrv->post(req);
                        break;
                case HTTP_DELETE:
-                       method = hdrv->delete;
+                       hdrv->delete(req);
                        break;
                default:
+                       http_response_header(req, METHOD_NOT_ALLOWED);
                        break;
                }
-
-               if (method != NULL) {
-                       method(req);
-                       if (req->status != UNKNOWN)
-                               goto out;
-               }
        }
-
-       http_response_header(req, METHOD_NOT_ALLOWED);
-out:
        http_end_request(req);
 }
 
-- 
1.7.9.5

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to