MCPcopy Create free account
hub / github.com/aria2/aria2 / createHttpRequest

Function createHttpRequest

src/HttpRequestCommand.cc:82–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81namespace {
82std::unique_ptr<HttpRequest>
83createHttpRequest(const std::shared_ptr<Request>& req,
84 const std::shared_ptr<FileEntry>& fileEntry,
85 const std::shared_ptr<Segment>& segment,
86 const std::shared_ptr<Option>& option, const RequestGroup* rg,
87 const DownloadEngine* e,
88 const std::shared_ptr<Request>& proxyRequest,
89 int64_t endOffset = 0)
90{
91 auto httpRequest = make_unique<HttpRequest>();
92 httpRequest->setUserAgent(option->get(PREF_USER_AGENT));
93 httpRequest->setRequest(req);
94 httpRequest->setFileEntry(fileEntry);
95 httpRequest->setSegment(segment);
96 httpRequest->addHeader(option->get(PREF_HEADER));
97 httpRequest->setCookieStorage(e->getCookieStorage().get());
98 httpRequest->setAuthConfigFactory(e->getAuthConfigFactory().get());
99 httpRequest->setOption(option.get());
100 httpRequest->setProxyRequest(proxyRequest);
101 httpRequest->setAcceptMetalink(rg->getDownloadContext()->getAcceptMetalink());
102 httpRequest->setNoWantDigest(option->getAsBool(PREF_NO_WANT_DIGEST_HEADER));
103
104 if (option->getAsBool(PREF_HTTP_ACCEPT_GZIP)) {
105 httpRequest->enableAcceptGZip();
106 }
107 else {
108 httpRequest->disableAcceptGZip();
109 }
110 if (option->getAsBool(PREF_HTTP_NO_CACHE)) {
111 httpRequest->enableNoCache();
112 }
113 else {
114 httpRequest->disableNoCache();
115 }
116 if (endOffset > 0) {
117 httpRequest->setEndOffsetOverride(endOffset);
118 }
119 return httpRequest;
120}
121} // namespace
122
123bool HttpRequestCommand::executeInternal()

Callers 1

executeInternalMethod · 0.85

Calls 15

setUserAgentMethod · 0.80
setSegmentMethod · 0.80
addHeaderMethod · 0.80
setCookieStorageMethod · 0.80
getCookieStorageMethod · 0.80
getAcceptMetalinkMethod · 0.80
setNoWantDigestMethod · 0.80
getAsBoolMethod · 0.80
enableAcceptGZipMethod · 0.80
disableAcceptGZipMethod · 0.80
enableNoCacheMethod · 0.80
disableNoCacheMethod · 0.80

Tested by

no test coverage detected