diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-08-03 12:36:02 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-08-03 12:36:02 +0000 |
| commit | 9251b47f6cccc7cd5175ab6858c3330eb0752061 (patch) | |
| tree | abc942ea6adea78fcb3b97d47df801b5232a74fa /src/FeatureConfig.cc | |
| parent | 928465b7bc638380004b39d6a5c6737f9f30faa0 (diff) | |
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
Diffstat (limited to 'src/FeatureConfig.cc')
| -rw-r--r-- | src/FeatureConfig.cc | 71 |
1 files changed, 49 insertions, 22 deletions
diff --git a/src/FeatureConfig.cc b/src/FeatureConfig.cc index 3f48b6a1..9e4ab013 100644 --- a/src/FeatureConfig.cc +++ b/src/FeatureConfig.cc @@ -21,36 +21,63 @@ /* copyright --> */ #include "FeatureConfig.h" -string FeatureConfig::FEATURE_HTTP = "http"; -string FeatureConfig::FEATURE_HTTPS = "https"; -string FeatureConfig::FEATURE_FTP = "ftp"; -string FeatureConfig::FEATURE_BITTORRENT = "bittorrent"; -string FeatureConfig::FEATURE_METALINK = "metalink"; +FeatureConfig* FeatureConfig::featureConfig = 0; -static ProtocolPortMap::value_type defaultPortsArray[] = { - ProtocolPortMap::value_type(FeatureConfig::FEATURE_HTTP, 80), - ProtocolPortMap::value_type(FeatureConfig::FEATURE_HTTPS, 443), - ProtocolPortMap::value_type(FeatureConfig::FEATURE_FTP, 21), -}; +#define FEATURE_HTTP "http" +#define FEATURE_HTTPS "https" +#define FEATURE_FTP "ftp" +#define FEATURE_BITTORRENT "bittorrent" +#define FEATURE_METALINK "metalink" +#define FEATURE_MESSAGE_DIGEST "message digest" -ProtocolPortMap FeatureConfig::defaultPorts(&defaultPortsArray[0], - &defaultPortsArray[3]); +FeatureConfig::FeatureConfig() { + static PortMap::value_type portArray[] = { + PortMap::value_type("http", 80), + PortMap::value_type("https", 443), + PortMap::value_type("ftp", 21), + }; + int portArraySize = sizeof(portArray)/sizeof(PortMap::value_type); + defaultPorts.insert(&portArray[0], + &portArray[portArraySize]); -static SupportedFeatureMap::value_type supportedFeaturesArray[] = { - SupportedFeatureMap::value_type(FeatureConfig::FEATURE_HTTP, true), + static FeatureMap::value_type featureArray[] = { + FeatureMap::value_type(FEATURE_HTTP, true), + FeatureMap::value_type(FEATURE_HTTPS, #ifdef ENABLE_SSL - SupportedFeatureMap::value_type(FeatureConfig::FEATURE_HTTPS, true), + true +#else + false #endif // ENABLE_SSL - SupportedFeatureMap::value_type(FeatureConfig::FEATURE_FTP, true), + ), + FeatureMap::value_type(FEATURE_FTP, true), + FeatureMap::value_type(FEATURE_BITTORRENT, #ifdef ENABLE_BITTORRENT - SupportedFeatureMap::value_type(FeatureConfig::FEATURE_BITTORRENT, true), + true +#else + false #endif // ENABLE_BITTORRENT + ), + FeatureMap::value_type(FEATURE_METALINK, #ifdef ENABLE_METALINK - SupportedFeatureMap::value_type(FeatureConfig::FEATURE_METALINK, true), + true +#else + false #endif // ENABLE_METALINK -}; + ), + FeatureMap::value_type(FEATURE_MESSAGE_DIGEST, +#ifdef ENABLE_MESSAGE_DIGEST + true +#else + false +#endif // ENABLE_MESSAGE_DIGEST + ), + }; -SupportedFeatureMap -FeatureConfig::supportedFeatures(&supportedFeaturesArray[0], - &supportedFeaturesArray[sizeof(supportedFeaturesArray)/sizeof(SupportedFeatureMap::value_type)]); + int featureArraySize = sizeof(featureArray)/sizeof(FeatureMap::value_type); + supportedFeatures.insert(&featureArray[0], + &featureArray[featureArraySize]); + for(int i = 0; i < featureArraySize; i++) { + features.push_back(featureArray[i].first); + } +} |
