[sheepdog] [PATCH 1/2] sheep/http: check http driver in http_init()

Liu Yuan namei.unix at gmail.com
Sun Jan 26 10:01:55 CET 2014


On Sun, Jan 26, 2014 at 04:08:35PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
> 
> If users start sheep daemon like:
> 
> sheep -r host=127.0.0.1,port=8000 -c local
> 
> the sheep will startup normally, but when someone access
> 127.0.0.1:8000 by swift interface, it will get message of
> "405 Method Not Allowed" without any explaination in sheep.log
> 
> The reason is we don't make sure http have at least one "driver".
> 
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
>  sheep/http/http.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sheep/http/http.c b/sheep/http/http.c
> index 7b25651..5e5b8d1 100644
> --- a/sheep/http/http.c
> +++ b/sheep/http/http.c
> @@ -394,6 +394,11 @@ int http_init(const char *options)
>  	if (option_parse(s, ",", http_opt_parsers) < 0)
>  		return -1;
>  
> +	if (list_empty(&http_enabled_drivers)) {
> +		sd_err("Please enable at least one http driver!");
> +		return -1;
> +	}
> +

I think we can make 'swift' as default driver if none is specified by user.

Thanks
Yuan



More information about the sheepdog mailing list