https.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. //-*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
  4. /* ######################################################################
  5. HTTPS Acquire Method - This is the HTTPS acquire method for APT.
  6. It uses libcurl
  7. ##################################################################### */
  8. /*}}}*/
  9. // Include Files /*{{{*/
  10. #include <config.h>
  11. #include <apt-pkg/fileutl.h>
  12. #include <apt-pkg/error.h>
  13. #include <apt-pkg/hashes.h>
  14. #include <apt-pkg/netrc.h>
  15. #include <apt-pkg/configuration.h>
  16. #include <apt-pkg/macros.h>
  17. #include <apt-pkg/strutl.h>
  18. #include <apt-pkg/proxy.h>
  19. #include <sys/stat.h>
  20. #include <sys/time.h>
  21. #include <unistd.h>
  22. #include <stdio.h>
  23. #include <iostream>
  24. #include <sstream>
  25. #include <ctype.h>
  26. #include <stdlib.h>
  27. #include "https.h"
  28. #include <apti18n.h>
  29. /*}}}*/
  30. using namespace std;
  31. struct APT_HIDDEN CURLUserPointer {
  32. HttpsMethod * const https;
  33. HttpsMethod::FetchResult * const Res;
  34. HttpsMethod::FetchItem const * const Itm;
  35. CURLUserPointer(HttpsMethod * const https, HttpsMethod::FetchResult * const Res,
  36. HttpsMethod::FetchItem const * const Itm) : https(https), Res(Res), Itm(Itm) {}
  37. };
  38. size_t
  39. HttpsMethod::parse_header(void *buffer, size_t size, size_t nmemb, void *userp)
  40. {
  41. size_t len = size * nmemb;
  42. CURLUserPointer *me = static_cast<CURLUserPointer *>(userp);
  43. std::string line((char*) buffer, len);
  44. for (--len; len > 0; --len)
  45. if (isspace_ascii(line[len]) == 0)
  46. {
  47. ++len;
  48. break;
  49. }
  50. line.erase(len);
  51. if (line.empty() == true)
  52. {
  53. if (me->https->Server->Result != 416 && me->https->Server->StartPos != 0)
  54. ;
  55. else if (me->https->Server->Result == 416)
  56. {
  57. bool partialHit = false;
  58. if (me->Itm->ExpectedHashes.usable() == true)
  59. {
  60. Hashes resultHashes(me->Itm->ExpectedHashes);
  61. FileFd file(me->Itm->DestFile, FileFd::ReadOnly);
  62. me->https->Server->TotalFileSize = file.FileSize();
  63. me->https->Server->Date = file.ModificationTime();
  64. resultHashes.AddFD(file);
  65. HashStringList const hashList = resultHashes.GetHashStringList();
  66. partialHit = (me->Itm->ExpectedHashes == hashList);
  67. }
  68. else if (me->https->Server->Result == 416 && me->https->Server->TotalFileSize == me->https->File->FileSize())
  69. partialHit = true;
  70. if (partialHit == true)
  71. {
  72. me->https->Server->Result = 200;
  73. me->https->Server->StartPos = me->https->Server->TotalFileSize;
  74. // the actual size is not important for https as curl will deal with it
  75. // by itself and e.g. doesn't bother us with transport-encoding…
  76. me->https->Server->JunkSize = std::numeric_limits<unsigned long long>::max();
  77. }
  78. else
  79. me->https->Server->StartPos = 0;
  80. }
  81. else
  82. me->https->Server->StartPos = 0;
  83. me->Res->LastModified = me->https->Server->Date;
  84. me->Res->Size = me->https->Server->TotalFileSize;
  85. me->Res->ResumePoint = me->https->Server->StartPos;
  86. // we expect valid data, so tell our caller we get the file now
  87. if (me->https->Server->Result >= 200 && me->https->Server->Result < 300)
  88. {
  89. if (me->https->Server->JunkSize == 0 && me->Res->Size != 0 && me->Res->Size > me->Res->ResumePoint)
  90. me->https->URIStart(*me->Res);
  91. if (me->https->Server->AddPartialFileToHashes(*(me->https->File)) == false)
  92. return 0;
  93. }
  94. }
  95. else if (me->https->Server->HeaderLine(line) == false)
  96. return 0;
  97. return size*nmemb;
  98. }
  99. size_t
  100. HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp)
  101. {
  102. HttpsMethod *me = static_cast<HttpsMethod *>(userp);
  103. size_t buffer_size = size * nmemb;
  104. // we don't need to count the junk here, just drop anything we get as
  105. // we don't always know how long it would be, e.g. in chunked encoding.
  106. if (me->Server->JunkSize != 0)
  107. return buffer_size;
  108. if(me->File->Write(buffer, buffer_size) != true)
  109. return 0;
  110. if(me->Queue->MaximumSize > 0)
  111. {
  112. unsigned long long const TotalWritten = me->File->Tell();
  113. if (TotalWritten > me->Queue->MaximumSize)
  114. {
  115. me->SetFailReason("MaximumSizeExceeded");
  116. _error->Error("Writing more data than expected (%llu > %llu)",
  117. TotalWritten, me->Queue->MaximumSize);
  118. return 0;
  119. }
  120. }
  121. if (me->Server->GetHashes()->Add((unsigned char const * const)buffer, buffer_size) == false)
  122. return 0;
  123. return buffer_size;
  124. }
  125. // HttpsServerState::HttpsServerState - Constructor /*{{{*/
  126. HttpsServerState::HttpsServerState(URI Srv,HttpsMethod * Owner) : ServerState(Srv, Owner), Hash(NULL)
  127. {
  128. TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut);
  129. Reset();
  130. }
  131. /*}}}*/
  132. bool HttpsServerState::InitHashes(HashStringList const &ExpectedHashes) /*{{{*/
  133. {
  134. delete Hash;
  135. Hash = new Hashes(ExpectedHashes);
  136. return true;
  137. }
  138. /*}}}*/
  139. APT_PURE Hashes * HttpsServerState::GetHashes() /*{{{*/
  140. {
  141. return Hash;
  142. }
  143. /*}}}*/
  144. bool HttpsMethod::SetupProxy() /*{{{*/
  145. {
  146. URI ServerName = Queue->Uri;
  147. // Determine the proxy setting
  148. AutoDetectProxy(ServerName);
  149. // Curl should never read proxy settings from the environment, as
  150. // we determine which proxy to use. Do this for consistency among
  151. // methods and prevent an environment variable overriding a
  152. // no-proxy ("DIRECT") setting in apt.conf.
  153. curl_easy_setopt(curl, CURLOPT_PROXY, "");
  154. // Determine the proxy setting - try https first, fallback to http and use env at last
  155. string UseProxy = _config->Find("Acquire::https::Proxy::" + ServerName.Host,
  156. _config->Find("Acquire::http::Proxy::" + ServerName.Host).c_str());
  157. if (UseProxy.empty() == true)
  158. UseProxy = _config->Find("Acquire::https::Proxy", _config->Find("Acquire::http::Proxy").c_str());
  159. // User want to use NO proxy, so nothing to setup
  160. if (UseProxy == "DIRECT")
  161. return true;
  162. // Parse no_proxy, a comma (,) separated list of domains we don't want to use
  163. // a proxy for so we stop right here if it is in the list
  164. if (getenv("no_proxy") != 0 && CheckDomainList(ServerName.Host,getenv("no_proxy")) == true)
  165. return true;
  166. if (UseProxy.empty() == true)
  167. {
  168. const char* result = getenv("https_proxy");
  169. // FIXME: Fall back to http_proxy is to remain compatible with
  170. // existing setups and behaviour of apt.conf. This should be
  171. // deprecated in the future (including apt.conf). Most other
  172. // programs do not fall back to http proxy settings and neither
  173. // should Apt.
  174. if (result == NULL)
  175. result = getenv("http_proxy");
  176. UseProxy = result == NULL ? "" : result;
  177. }
  178. // Determine what host and port to use based on the proxy settings
  179. if (UseProxy.empty() == false)
  180. {
  181. Proxy = UseProxy;
  182. if (Proxy.Access == "socks5h")
  183. curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
  184. else if (Proxy.Access == "socks5")
  185. curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  186. else if (Proxy.Access == "socks4a")
  187. curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
  188. else if (Proxy.Access == "socks")
  189. curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
  190. else if (Proxy.Access == "http" || Proxy.Access == "https")
  191. curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
  192. else
  193. return false;
  194. if (Proxy.Port != 1)
  195. curl_easy_setopt(curl, CURLOPT_PROXYPORT, Proxy.Port);
  196. curl_easy_setopt(curl, CURLOPT_PROXY, Proxy.Host.c_str());
  197. if (Proxy.User.empty() == false || Proxy.Password.empty() == false)
  198. {
  199. curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, Proxy.User.c_str());
  200. curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, Proxy.Password.c_str());
  201. }
  202. }
  203. return true;
  204. } /*}}}*/
  205. // HttpsMethod::Fetch - Fetch an item /*{{{*/
  206. // ---------------------------------------------------------------------
  207. /* This adds an item to the pipeline. We keep the pipeline at a fixed
  208. depth. */
  209. bool HttpsMethod::Fetch(FetchItem *Itm)
  210. {
  211. struct stat SBuf;
  212. struct curl_slist *headers=NULL;
  213. char curl_errorstr[CURL_ERROR_SIZE];
  214. URI Uri = Itm->Uri;
  215. string remotehost = Uri.Host;
  216. // TODO:
  217. // - http::Pipeline-Depth
  218. // - error checking/reporting
  219. // - more debug options? (CURLOPT_DEBUGFUNCTION?)
  220. curl_easy_reset(curl);
  221. if (SetupProxy() == false)
  222. return _error->Error("Unsupported proxy configured: %s", URI::SiteOnly(Proxy).c_str());
  223. maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc"));
  224. FetchResult Res;
  225. CURLUserPointer userp(this, &Res, Itm);
  226. // callbacks
  227. curl_easy_setopt(curl, CURLOPT_URL, static_cast<string>(Uri).c_str());
  228. curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, parse_header);
  229. curl_easy_setopt(curl, CURLOPT_WRITEHEADER, &userp);
  230. curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
  231. curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
  232. // options
  233. curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
  234. curl_easy_setopt(curl, CURLOPT_FILETIME, true);
  235. // only allow curl to handle https, not the other stuff it supports
  236. curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
  237. curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
  238. // SSL parameters are set by default to the common (non mirror-specific) value
  239. // if available (or a default one) and gets overload by mirror-specific ones.
  240. // File containing the list of trusted CA.
  241. string cainfo = _config->Find("Acquire::https::CaInfo","");
  242. string knob = "Acquire::https::"+remotehost+"::CaInfo";
  243. cainfo = _config->Find(knob.c_str(),cainfo.c_str());
  244. if(cainfo.empty() == false)
  245. curl_easy_setopt(curl, CURLOPT_CAINFO,cainfo.c_str());
  246. // Check server certificate against previous CA list ...
  247. bool peer_verify = _config->FindB("Acquire::https::Verify-Peer",true);
  248. knob = "Acquire::https::" + remotehost + "::Verify-Peer";
  249. peer_verify = _config->FindB(knob.c_str(), peer_verify);
  250. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, peer_verify);
  251. // ... and hostname against cert CN or subjectAltName
  252. bool verify = _config->FindB("Acquire::https::Verify-Host",true);
  253. knob = "Acquire::https::"+remotehost+"::Verify-Host";
  254. verify = _config->FindB(knob.c_str(),verify);
  255. int const default_verify = (verify == true) ? 2 : 0;
  256. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, default_verify);
  257. // Also enforce issuer of server certificate using its cert
  258. string issuercert = _config->Find("Acquire::https::IssuerCert","");
  259. knob = "Acquire::https::"+remotehost+"::IssuerCert";
  260. issuercert = _config->Find(knob.c_str(),issuercert.c_str());
  261. if(issuercert.empty() == false)
  262. curl_easy_setopt(curl, CURLOPT_ISSUERCERT,issuercert.c_str());
  263. // For client authentication, certificate file ...
  264. string pem = _config->Find("Acquire::https::SslCert","");
  265. knob = "Acquire::https::"+remotehost+"::SslCert";
  266. pem = _config->Find(knob.c_str(),pem.c_str());
  267. if(pem.empty() == false)
  268. curl_easy_setopt(curl, CURLOPT_SSLCERT, pem.c_str());
  269. // ... and associated key.
  270. string key = _config->Find("Acquire::https::SslKey","");
  271. knob = "Acquire::https::"+remotehost+"::SslKey";
  272. key = _config->Find(knob.c_str(),key.c_str());
  273. if(key.empty() == false)
  274. curl_easy_setopt(curl, CURLOPT_SSLKEY, key.c_str());
  275. // Allow forcing SSL version to SSLv3 or TLSv1 (SSLv2 is not
  276. // supported by GnuTLS).
  277. long final_version = CURL_SSLVERSION_DEFAULT;
  278. string sslversion = _config->Find("Acquire::https::SslForceVersion","");
  279. knob = "Acquire::https::"+remotehost+"::SslForceVersion";
  280. sslversion = _config->Find(knob.c_str(),sslversion.c_str());
  281. if(sslversion == "TLSv1")
  282. final_version = CURL_SSLVERSION_TLSv1;
  283. else if(sslversion == "SSLv3")
  284. final_version = CURL_SSLVERSION_SSLv3;
  285. curl_easy_setopt(curl, CURLOPT_SSLVERSION, final_version);
  286. // CRL file
  287. string crlfile = _config->Find("Acquire::https::CrlFile","");
  288. knob = "Acquire::https::"+remotehost+"::CrlFile";
  289. crlfile = _config->Find(knob.c_str(),crlfile.c_str());
  290. if(crlfile.empty() == false)
  291. curl_easy_setopt(curl, CURLOPT_CRLFILE, crlfile.c_str());
  292. // cache-control
  293. if(_config->FindB("Acquire::https::No-Cache",
  294. _config->FindB("Acquire::http::No-Cache",false)) == false)
  295. {
  296. // cache enabled
  297. if (_config->FindB("Acquire::https::No-Store",
  298. _config->FindB("Acquire::http::No-Store",false)) == true)
  299. headers = curl_slist_append(headers,"Cache-Control: no-store");
  300. stringstream ss;
  301. ioprintf(ss, "Cache-Control: max-age=%u", _config->FindI("Acquire::https::Max-Age",
  302. _config->FindI("Acquire::http::Max-Age",0)));
  303. headers = curl_slist_append(headers, ss.str().c_str());
  304. } else {
  305. // cache disabled by user
  306. headers = curl_slist_append(headers, "Cache-Control: no-cache");
  307. headers = curl_slist_append(headers, "Pragma: no-cache");
  308. }
  309. curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  310. // speed limit
  311. int const dlLimit = _config->FindI("Acquire::https::Dl-Limit",
  312. _config->FindI("Acquire::http::Dl-Limit",0))*1024;
  313. if (dlLimit > 0)
  314. curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, dlLimit);
  315. // set header
  316. curl_easy_setopt(curl, CURLOPT_USERAGENT,
  317. _config->Find("Acquire::https::User-Agent",
  318. _config->Find("Acquire::http::User-Agent",
  319. "Debian APT-CURL/1.0 (" PACKAGE_VERSION ")").c_str()).c_str());
  320. // set timeout
  321. int const timeout = _config->FindI("Acquire::https::Timeout",
  322. _config->FindI("Acquire::http::Timeout",120));
  323. curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, timeout);
  324. //set really low lowspeed timeout (see #497983)
  325. curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, DL_MIN_SPEED);
  326. curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, timeout);
  327. // set redirect options and default to 10 redirects
  328. curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, AllowRedirect);
  329. curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10);
  330. // debug
  331. if (Debug == true)
  332. curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
  333. // error handling
  334. curl_errorstr[0] = '\0';
  335. curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
  336. // If we ask for uncompressed files servers might respond with content-
  337. // negotiation which lets us end up with compressed files we do not support,
  338. // see 657029, 657560 and co, so if we have no extension on the request
  339. // ask for text only. As a sidenote: If there is nothing to negotate servers
  340. // seem to be nice and ignore it.
  341. if (_config->FindB("Acquire::https::SendAccept", _config->FindB("Acquire::http::SendAccept", true)) == true)
  342. {
  343. size_t const filepos = Itm->Uri.find_last_of('/');
  344. string const file = Itm->Uri.substr(filepos + 1);
  345. if (flExtension(file) == file)
  346. headers = curl_slist_append(headers, "Accept: text/*");
  347. }
  348. // if we have the file send an if-range query with a range header
  349. if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
  350. {
  351. std::string Buf;
  352. strprintf(Buf, "Range: bytes=%lli-", (long long) SBuf.st_size);
  353. headers = curl_slist_append(headers, Buf.c_str());
  354. strprintf(Buf, "If-Range: %s", TimeRFC1123(SBuf.st_mtime, false).c_str());
  355. headers = curl_slist_append(headers, Buf.c_str());
  356. }
  357. else if(Itm->LastModified > 0)
  358. {
  359. curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
  360. curl_easy_setopt(curl, CURLOPT_TIMEVALUE, Itm->LastModified);
  361. }
  362. // go for it - if the file exists, append on it
  363. File = new FileFd(Itm->DestFile, FileFd::WriteAny);
  364. Server = CreateServerState(Itm->Uri);
  365. if (Server->InitHashes(Itm->ExpectedHashes) == false)
  366. return false;
  367. // keep apt updated
  368. Res.Filename = Itm->DestFile;
  369. // get it!
  370. CURLcode success = curl_easy_perform(curl);
  371. // If the server returns 200 OK but the If-Modified-Since condition is not
  372. // met, CURLINFO_CONDITION_UNMET will be set to 1
  373. long curl_condition_unmet = 0;
  374. curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &curl_condition_unmet);
  375. File->Close();
  376. curl_slist_free_all(headers);
  377. // cleanup
  378. if (success != CURLE_OK)
  379. {
  380. #pragma GCC diagnostic push
  381. #pragma GCC diagnostic ignored "-Wswitch"
  382. switch (success)
  383. {
  384. case CURLE_COULDNT_RESOLVE_PROXY:
  385. case CURLE_COULDNT_RESOLVE_HOST:
  386. SetFailReason("ResolveFailure");
  387. break;
  388. case CURLE_COULDNT_CONNECT:
  389. SetFailReason("ConnectionRefused");
  390. break;
  391. case CURLE_OPERATION_TIMEDOUT:
  392. SetFailReason("Timeout");
  393. break;
  394. }
  395. #pragma GCC diagnostic pop
  396. // only take curls technical errors if we haven't our own
  397. // (e.g. for the maximum size limit we have and curls can be confusing)
  398. if (_error->PendingError() == false)
  399. _error->Error("%s", curl_errorstr);
  400. else
  401. _error->Warning("curl: %s", curl_errorstr);
  402. return false;
  403. }
  404. // server says file not modified
  405. if (Server->Result == 304 || curl_condition_unmet == 1)
  406. {
  407. RemoveFile("https", File->Name());
  408. Res.IMSHit = true;
  409. Res.LastModified = Itm->LastModified;
  410. Res.Size = 0;
  411. URIDone(Res);
  412. return true;
  413. }
  414. Res.IMSHit = false;
  415. if (Server->Result != 200 && // OK
  416. Server->Result != 206 && // Partial
  417. Server->Result != 416) // invalid Range
  418. {
  419. char err[255];
  420. snprintf(err, sizeof(err) - 1, "HttpError%i", Server->Result);
  421. SetFailReason(err);
  422. _error->Error("%i %s", Server->Result, Server->Code);
  423. // unlink, no need keep 401/404 page content in partial/
  424. RemoveFile("https", File->Name());
  425. return false;
  426. }
  427. // invalid range-request
  428. if (Server->Result == 416)
  429. {
  430. RemoveFile("https", File->Name());
  431. delete File;
  432. Redirect(Itm->Uri);
  433. return true;
  434. }
  435. struct stat resultStat;
  436. if (unlikely(stat(File->Name().c_str(), &resultStat) != 0))
  437. {
  438. _error->Errno("stat", "Unable to access file %s", File->Name().c_str());
  439. return false;
  440. }
  441. Res.Size = resultStat.st_size;
  442. // Timestamp
  443. curl_easy_getinfo(curl, CURLINFO_FILETIME, &Res.LastModified);
  444. if (Res.LastModified != -1)
  445. {
  446. struct timeval times[2];
  447. times[0].tv_sec = Res.LastModified;
  448. times[1].tv_sec = Res.LastModified;
  449. times[0].tv_usec = times[1].tv_usec = 0;
  450. utimes(File->Name().c_str(), times);
  451. }
  452. else
  453. Res.LastModified = resultStat.st_mtime;
  454. // take hashes
  455. Res.TakeHashes(*(Server->GetHashes()));
  456. // keep apt updated
  457. URIDone(Res);
  458. // cleanup
  459. delete File;
  460. return true;
  461. }
  462. /*}}}*/
  463. // HttpsMethod::Configuration - Handle a configuration message /*{{{*/
  464. bool HttpsMethod::Configuration(string Message)
  465. {
  466. if (ServerMethod::Configuration(Message) == false)
  467. return false;
  468. AllowRedirect = _config->FindB("Acquire::https::AllowRedirect",
  469. _config->FindB("Acquire::http::AllowRedirect", true));
  470. Debug = _config->FindB("Debug::Acquire::https",false);
  471. return true;
  472. }
  473. /*}}}*/
  474. std::unique_ptr<ServerState> HttpsMethod::CreateServerState(URI const &uri)/*{{{*/
  475. {
  476. return std::unique_ptr<ServerState>(new HttpsServerState(uri, this));
  477. }
  478. /*}}}*/
  479. int main()
  480. {
  481. return HttpsMethod().Run();
  482. }