On Fri, Nov 15, 2013 at 03:56:05AM +0900, MORITA Kazutaka wrote:
> At Thu, 14 Nov 2013 17:03:54 +0800,
> Liu Yuan wrote:
> > 
> > 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);
> >  }
> 
> With this change, we have to implement all the http methods for each
> http drivers, but I think it's not a good idea.  If we add another
> http_opcode in future, we have to update all the http drivers.
> Moreover, I'm planning to add other drivers which will work on top of
> s3 and swift API, and I think some of those drivers don't need to
> handle all the http methods.
> 

Okay, if you have other plans in head with current structure, I'm fine to keep
it.

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

Reply via email to