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

Robin Dong robin.k.dong at gmail.com
Sun Jan 26 10:22:42 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

So we use 'swift' as default http driver if users doesn't point out
in command line.

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..cf658c6 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)) {
+		http_opt_default_parser("swift");
+		sd_debug("Use swift as default http driver");
+	}
+
 	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