From 0742e3921f185613f98c2b31cd03182d8aa1d6f5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 25 Jan 2009 09:58:40 +0000 Subject: 2009-01-25 Tatsuhiro Tsujikawa Added experimental built-in HTTP server. Currently, when a client accesses to the server, it responds with the current download progress. By default, it is disabled. To enable the server, give --enable-http-server option. To change the default port number for the server to listen to, use --http-server-listen-port option. The response HTML is very simple and refreshes it self each 1 second. Because of this refresh, you see flicker in normal web browser such as Firefox. I recommend to use console-based browser such as elinks, w3m. To connect to the server, run 'elinks http://localhost:6800/' while running aria2. Please replace port number '6800'(which is default) with your preference. * src/DownloadEngineFactory.cc * src/HttpHeader.cc * src/HttpHeader.h * src/HttpHeaderProcessor.cc * src/HttpHeaderProcessor.h * src/HttpListenCommand.cc * src/HttpListenCommand.h * src/HttpServer.cc * src/HttpServer.h * src/HttpServerCommand.cc * src/HttpServerCommand.h * src/HttpServerResponseCommand.cc * src/HttpServerResponseCommand.h * src/Makefile.am * src/OptionHandlerFactory.cc * src/Util.cc * src/Util.h * src/help_tags.h * src/option_processing.cc * src/prefs.cc * src/prefs.h * src/usage_text.h * test/HttpHeaderProcessorTest.cc * test/UtilTest.cc --- src/OptionHandlerFactory.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/OptionHandlerFactory.cc') diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index f662b5b7..4db13b09 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -150,6 +150,14 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_ADVANCED); handlers.push_back(op); } + { + SharedHandle op(new BooleanOptionHandler + (PREF_ENABLE_HTTP_SERVER, + TEXT_ENABLE_HTTP_SERVER, + V_FALSE)); + op->addTag(TAG_EXPERIMENTAL); + handlers.push_back(op); + } { std::string params[] = { #ifdef HAVE_EPOLL @@ -187,6 +195,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_BASIC); handlers.push_back(op); } + { + SharedHandle op(new NumberOptionHandler + (PREF_HTTP_SERVER_LISTEN_PORT, + TEXT_HTTP_SERVER_LISTEN_PORT, + "6800", + 1024, UINT16_MAX)); + op->addTag(TAG_EXPERIMENTAL); + handlers.push_back(op); + } { SharedHandle op(new DefaultOptionHandler (PREF_INPUT_FILE, @@ -1013,7 +1030,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() ("help", TEXT_HELP, TAG_BASIC, - StringFormat("%s,%s,%s,%s,%s,%s,%s,%s,all", + StringFormat("%s,%s,%s,%s,%s,%s,%s,%s,%s,all", TAG_BASIC, TAG_ADVANCED, TAG_HTTP, @@ -1021,6 +1038,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() TAG_FTP, TAG_METALINK, TAG_BITTORRENT, + TAG_EXPERIMENTAL, TAG_HELP).str())); op->addTag(TAG_BASIC); op->addTag(TAG_HELP); -- cgit