https.cc 18 KB

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