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

Robin Dong robin.k.dong at gmail.com
Sun Jan 26 09:08:35 CET 2014


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;
+	}
+
 	sys->http_wqueue = create_work_queue("http", WQ_DYNAMIC);
 	if (!sys->http_wqueue)
 		return -1;
-- 
1.7.12.4




More information about the sheepdog mailing list