From 682bafae0af4bcd119164020fb5b4006476f52d0 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 14 Jul 2009 12:37:34 +0000 Subject: [PATCH] 2009-07-13 Tatsuhiro Tsujikawa Use option of each download to create AuthConfig instead of global option. * src/AuthConfigFactory.cc * src/AuthConfigFactory.h * src/FtpNegotiationCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpSkipResponseCommand.cc * src/MultiUrlRequestInfo.cc * test/AuthConfigFactoryTest.cc * test/FtpConnectionTest.cc * test/HttpRequestTest.cc --- ChangeLog | 16 +++++++++ src/AuthConfigFactory.cc | 34 +++++++++++-------- src/AuthConfigFactory.h | 24 +++++++++----- src/FtpNegotiationCommand.cc | 3 +- src/HttpRequest.cc | 5 +-- src/HttpRequest.h | 5 ++- src/HttpRequestCommand.cc | 2 +- src/HttpSkipResponseCommand.cc | 2 +- src/MultiUrlRequestInfo.cc | 3 +- test/AuthConfigFactoryTest.cc | 60 +++++++++++++++++----------------- test/FtpConnectionTest.cc | 5 +-- test/HttpRequestTest.cc | 23 ++++++------- 12 files changed, 108 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67c55293..fe4d1002 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-07-13 Tatsuhiro Tsujikawa + + Use option of each download to create AuthConfig instead of global + option. + * src/AuthConfigFactory.cc + * src/AuthConfigFactory.h + * src/FtpNegotiationCommand.cc + * src/HttpRequest.cc + * src/HttpRequest.h + * src/HttpRequestCommand.cc + * src/HttpSkipResponseCommand.cc + * src/MultiUrlRequestInfo.cc + * test/AuthConfigFactoryTest.cc + * test/FtpConnectionTest.cc + * test/HttpRequestTest.cc + 2009-07-13 Tatsuhiro Tsujikawa Don't call prepareForRetry(1) if all segments are ignored in diff --git a/src/AuthConfigFactory.cc b/src/AuthConfigFactory.cc index 054091bf..fe958d36 100644 --- a/src/AuthConfigFactory.cc +++ b/src/AuthConfigFactory.cc @@ -51,18 +51,18 @@ const std::string AuthConfigFactory::ANONYMOUS("anonymous"); const std::string AuthConfigFactory::ARIA2USER_AT("ARIA2USER@"); -AuthConfigFactory::AuthConfigFactory(const Option* option): - _option(option) {} +AuthConfigFactory::AuthConfigFactory() {} AuthConfigFactory::~AuthConfigFactory() {} AuthConfigHandle -AuthConfigFactory::createAuthConfig(const RequestHandle& request) +AuthConfigFactory::createAuthConfig +(const SharedHandle& request, const Option* op) { if(request->getProtocol() == Request::PROTO_HTTP || request->getProtocol() == Request::PROTO_HTTPS) { - if(_option->getAsBool(PREF_HTTP_AUTH_CHALLENGE)) { + if(op->getAsBool(PREF_HTTP_AUTH_CHALLENGE)) { if(!request->getUsername().empty()) { // TODO setting "/" as path. Should we use request->getDir() instead? updateBasicCred(BasicCred(request->getUsername(), request->getPassword(), @@ -80,14 +80,16 @@ AuthConfigFactory::createAuthConfig(const RequestHandle& request) if(!request->getUsername().empty()) { return createAuthConfig(request->getUsername(), request->getPassword()); } else { - return createHttpAuthResolver()->resolveAuthConfig(request->getHost()); + return + createHttpAuthResolver(op)->resolveAuthConfig(request->getHost()); } } } else if(request->getProtocol() == Request::PROTO_FTP) { if(!request->getUsername().empty()) { return createAuthConfig(request->getUsername(), request->getPassword()); } else { - return createFtpAuthResolver()->resolveAuthConfig(request->getHost()); + return + createFtpAuthResolver(op)->resolveAuthConfig(request->getHost()); } } else { return SharedHandle(); @@ -104,10 +106,11 @@ AuthConfigFactory::createAuthConfig(const std::string& user, const std::string& return ac; } -AuthResolverHandle AuthConfigFactory::createHttpAuthResolver() const +AuthResolverHandle AuthConfigFactory::createHttpAuthResolver +(const Option* op) const { AbstractAuthResolverHandle resolver; - if(_option->getAsBool(PREF_NO_NETRC)) { + if(op->getAsBool(PREF_NO_NETRC)) { resolver.reset(new DefaultAuthResolver()); } else { NetrcAuthResolverHandle authResolver(new NetrcAuthResolver()); @@ -115,21 +118,24 @@ AuthResolverHandle AuthConfigFactory::createHttpAuthResolver() const authResolver->ignoreDefault(); resolver = authResolver; } - resolver->setUserDefinedAuthConfig(createAuthConfig(_option->get(PREF_HTTP_USER), _option->get(PREF_HTTP_PASSWD))); + resolver->setUserDefinedAuthConfig + (createAuthConfig(op->get(PREF_HTTP_USER), op->get(PREF_HTTP_PASSWD))); return resolver; } -AuthResolverHandle AuthConfigFactory::createFtpAuthResolver() const +AuthResolverHandle AuthConfigFactory::createFtpAuthResolver +(const Option* op) const { AbstractAuthResolverHandle resolver; - if(_option->getAsBool(PREF_NO_NETRC)) { + if(op->getAsBool(PREF_NO_NETRC)) { resolver.reset(new DefaultAuthResolver()); } else { NetrcAuthResolverHandle authResolver(new NetrcAuthResolver()); authResolver->setNetrc(_netrc); resolver = authResolver; } - resolver->setUserDefinedAuthConfig(createAuthConfig(_option->get(PREF_FTP_USER), _option->get(PREF_FTP_PASSWD))); + resolver->setUserDefinedAuthConfig + (createAuthConfig(op->get(PREF_FTP_USER), op->get(PREF_FTP_PASSWD))); SharedHandle defaultAuthConfig (new AuthConfig(AuthConfigFactory::ANONYMOUS, AuthConfigFactory::ARIA2USER_AT)); @@ -155,14 +161,14 @@ void AuthConfigFactory::updateBasicCred(const BasicCred& basicCred) } bool AuthConfigFactory::activateBasicCred -(const std::string& host, const std::string& path) +(const std::string& host, const std::string& path, const Option* op) { std::deque::iterator i = findBasicCred(host, path); if(i == _basicCreds.end()) { SharedHandle authConfig = - createHttpAuthResolver()->resolveAuthConfig(host); + createHttpAuthResolver(op)->resolveAuthConfig(host); if(authConfig.isNull()) { return false; } else { diff --git a/src/AuthConfigFactory.h b/src/AuthConfigFactory.h index b0d53c8e..a578a637 100644 --- a/src/AuthConfigFactory.h +++ b/src/AuthConfigFactory.h @@ -53,16 +53,14 @@ class AuthResolver; class AuthConfigFactory { private: - const Option* _option; - SharedHandle _netrc; SharedHandle createAuthConfig(const std::string& user, const std::string& password) const; - SharedHandle createHttpAuthResolver() const; + SharedHandle createHttpAuthResolver(const Option* op) const; - SharedHandle createFtpAuthResolver() const; + SharedHandle createFtpAuthResolver(const Option* op) const; public: class BasicCred { public: @@ -88,19 +86,27 @@ private: std::deque _basicCreds; public: - AuthConfigFactory(const Option* option); + AuthConfigFactory(); ~AuthConfigFactory(); + // Creates AuthConfig object for request. Following option values + // are used in this method: PREF_HTTP_USER, PREF_HTTP_PASSWD, + // PREF_FTP_USER, PREF_FTP_PASSWD, PREF_NO_NETRC and + // PREF_HTTP_AUTH_CHALLENGE. SharedHandle createAuthConfig - (const SharedHandle& request); + (const SharedHandle& request, const Option* op); void setNetrc(const SharedHandle& netrc); // Find a BasicCred using findBasicCred() and activate it then - // return true. If matching BasicCred is not found, then return - // false. - bool activateBasicCred(const std::string& host, const std::string& path); + // return true. If matching BasicCred is not found, AuthConfig + // object is created using createHttpAuthResolver and op. If it is + // null, then returns false. Otherwise new BasicCred is created + // using this AuthConfig object with given host and path "/" and + // returns true. + bool activateBasicCred + (const std::string& host, const std::string& path, const Option* op); // Find a BasicCred using host and path and return the iterator // pointing to it. If not found, then return _basicCreds.end(). diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index a4312c70..b49840b7 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -79,7 +79,8 @@ FtpNegotiationCommand::FtpNegotiationCommand const std::string& baseWorkingDir): AbstractCommand(cuid, req, fileEntry, requestGroup, e, s), sequence(seq), ftp(new FtpConnection(cuid, socket, req, - e->getAuthConfigFactory()->createAuthConfig(req), + e->getAuthConfigFactory()->createAuthConfig + (req, requestGroup->getOption().get()), getOption().get())) { ftp->setBaseWorkingDir(baseWorkingDir); diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 340eb3ab..3c4e8f06 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -128,7 +128,7 @@ std::string HttpRequest::getHostText(const std::string& host, uint16_t port) con std::string HttpRequest::createRequest() { - _authConfig = _authConfigFactory->createAuthConfig(request); + _authConfig = _authConfigFactory->createAuthConfig(request, _option); std::string requestLine = request->getMethod(); requestLine += " "; if(!_proxyRequest.isNull()) { @@ -293,9 +293,10 @@ void HttpRequest::setCookieStorage } void HttpRequest::setAuthConfigFactory -(const SharedHandle& factory) +(const SharedHandle& factory, const Option* option) { _authConfigFactory = factory; + _option = option; } void HttpRequest::setProxyRequest(const SharedHandle& proxyRequest) diff --git a/src/HttpRequest.h b/src/HttpRequest.h index def1ddd6..18a0768b 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -77,6 +77,8 @@ private: SharedHandle _authConfigFactory; + const Option* _option; + SharedHandle _authConfig; SharedHandle _proxyRequest; @@ -206,7 +208,8 @@ public: return _cookieStorage; } - void setAuthConfigFactory(const SharedHandle& factory); + void setAuthConfigFactory + (const SharedHandle& factory, const Option* option); /* * To use proxy, pass proxy string to Request::setUrl() and set it this diff --git a/src/HttpRequestCommand.cc b/src/HttpRequestCommand.cc index 76c4875d..9ce7e5a9 100644 --- a/src/HttpRequestCommand.cc +++ b/src/HttpRequestCommand.cc @@ -92,7 +92,7 @@ createHttpRequest(const SharedHandle& req, httpRequest->setSegment(segment); httpRequest->addHeader(option->get(PREF_HEADER)); httpRequest->setCookieStorage(cookieStorage); - httpRequest->setAuthConfigFactory(authConfigFactory); + httpRequest->setAuthConfigFactory(authConfigFactory, option.get()); httpRequest->setProxyRequest(proxyRequest); httpRequest->addAcceptType(rg->getAcceptTypes().begin(), rg->getAcceptTypes().end()); diff --git a/src/HttpSkipResponseCommand.cc b/src/HttpSkipResponseCommand.cc index 685c785c..c85af39b 100644 --- a/src/HttpSkipResponseCommand.cc +++ b/src/HttpSkipResponseCommand.cc @@ -164,7 +164,7 @@ bool HttpSkipResponseCommand::processResponse() if(getOption()->getAsBool(PREF_HTTP_AUTH_CHALLENGE) && !_httpResponse->getHttpRequest()->authenticationUsed() && e->getAuthConfigFactory()->activateBasicCred - (req->getHost(), req->getDir())) { + (req->getHost(), req->getDir(), getOption().get())) { return prepareForRetry(0); } else { throw DL_ABORT_EX(EX_AUTH_FAILED); diff --git a/src/MultiUrlRequestInfo.cc b/src/MultiUrlRequestInfo.cc index bec4265a..0fca516a 100644 --- a/src/MultiUrlRequestInfo.cc +++ b/src/MultiUrlRequestInfo.cc @@ -117,8 +117,7 @@ downloadresultcode::RESULT MultiUrlRequestInfo::execute() } } - SharedHandle authConfigFactory - (new AuthConfigFactory(_option.get())); + SharedHandle authConfigFactory(new AuthConfigFactory()); File netrccf(_option->get(PREF_NETRC_PATH)); if(!_option->getAsBool(PREF_NO_NETRC) && netrccf.isFile()) { mode_t mode = netrccf.mode(); diff --git a/test/AuthConfigFactoryTest.cc b/test/AuthConfigFactoryTest.cc index 575c7d59..9b5249aa 100644 --- a/test/AuthConfigFactoryTest.cc +++ b/test/AuthConfigFactoryTest.cc @@ -38,10 +38,10 @@ void AuthConfigFactoryTest::testCreateAuthConfig_http() option.put(PREF_NO_NETRC, V_FALSE); option.put(PREF_HTTP_AUTH_CHALLENGE, V_TRUE); - AuthConfigFactory factory(&option); + AuthConfigFactory factory; // without auth info - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); // with Netrc SharedHandle netrc(new Netrc()); @@ -55,35 +55,35 @@ void AuthConfigFactoryTest::testCreateAuthConfig_http() factory.setNetrc(netrc); // not activated - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); - CPPUNIT_ASSERT(factory.activateBasicCred("localhost", "/")); + CPPUNIT_ASSERT(factory.activateBasicCred("localhost", "/", &option)); CPPUNIT_ASSERT_EQUAL(std::string("localhostuser:localhostpass"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // See default token in netrc is ignored. req->setUrl("http://mirror/"); - CPPUNIT_ASSERT(!factory.activateBasicCred("mirror", "/")); + CPPUNIT_ASSERT(!factory.activateBasicCred("mirror", "/", &option)); - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); // with Netrc + user defined option.put(PREF_HTTP_USER, "userDefinedUser"); option.put(PREF_HTTP_PASSWD, "userDefinedPassword"); - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); - CPPUNIT_ASSERT(factory.activateBasicCred("mirror", "/")); + CPPUNIT_ASSERT(factory.activateBasicCred("mirror", "/", &option)); CPPUNIT_ASSERT_EQUAL(std::string("userDefinedUser:userDefinedPassword"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // username and password in URI req->setUrl("http://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); CPPUNIT_ASSERT_EQUAL(std::string("aria2user:aria2password"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); } void AuthConfigFactoryTest::testCreateAuthConfig_httpNoChallenge() @@ -94,10 +94,10 @@ void AuthConfigFactoryTest::testCreateAuthConfig_httpNoChallenge() Option option; option.put(PREF_NO_NETRC, V_FALSE); - AuthConfigFactory factory(&option); + AuthConfigFactory factory; // without auth info - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); // with Netrc SharedHandle netrc(new Netrc()); @@ -112,24 +112,24 @@ void AuthConfigFactoryTest::testCreateAuthConfig_httpNoChallenge() // not activated CPPUNIT_ASSERT_EQUAL(std::string("localhostuser:localhostpass"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // See default token in netrc is ignored. req->setUrl("http://mirror/"); - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); // with Netrc + user defined option.put(PREF_HTTP_USER, "userDefinedUser"); option.put(PREF_HTTP_PASSWD, "userDefinedPassword"); CPPUNIT_ASSERT_EQUAL(std::string("userDefinedUser:userDefinedPassword"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // username and password in URI req->setUrl("http://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); CPPUNIT_ASSERT_EQUAL(std::string("aria2user:aria2password"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); } void AuthConfigFactoryTest::testCreateAuthConfig_ftp() @@ -140,11 +140,11 @@ void AuthConfigFactoryTest::testCreateAuthConfig_ftp() Option option; option.put(PREF_NO_NETRC, V_FALSE); - AuthConfigFactory factory(&option); + AuthConfigFactory factory; // without auth info CPPUNIT_ASSERT_EQUAL(std::string("anonymous:ARIA2USER@"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // with Netrc SharedHandle netrc(new Netrc()); @@ -152,24 +152,24 @@ void AuthConfigFactoryTest::testCreateAuthConfig_ftp() (SharedHandle(new DefaultAuthenticator("default", "defaultpassword", "defaultaccount"))); factory.setNetrc(netrc); CPPUNIT_ASSERT_EQUAL(std::string("default:defaultpassword"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // disable Netrc option.put(PREF_NO_NETRC, V_TRUE); CPPUNIT_ASSERT_EQUAL(std::string("anonymous:ARIA2USER@"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // with Netrc + user defined option.put(PREF_NO_NETRC, V_FALSE); option.put(PREF_FTP_USER, "userDefinedUser"); option.put(PREF_FTP_PASSWD, "userDefinedPassword"); CPPUNIT_ASSERT_EQUAL(std::string("userDefinedUser:userDefinedPassword"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); // username and password in URI req->setUrl("ftp://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); CPPUNIT_ASSERT_EQUAL(std::string("aria2user:aria2password"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); } void AuthConfigFactoryTest::testUpdateBasicCred() @@ -178,7 +178,7 @@ void AuthConfigFactoryTest::testUpdateBasicCred() option.put(PREF_NO_NETRC, V_FALSE); option.put(PREF_HTTP_AUTH_CHALLENGE, V_TRUE); - AuthConfigFactory factory(&option); + AuthConfigFactory factory; factory.updateBasicCred (AuthConfigFactory::BasicCred("myname", "mypass", "localhost", "/", true)); @@ -193,25 +193,25 @@ void AuthConfigFactoryTest::testUpdateBasicCred() req->setUrl("http://localhost/download/v2.6/Changelog"); CPPUNIT_ASSERT_EQUAL(std::string("price:j38jdc"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); req->setUrl("http://localhost/documents/reference.html"); CPPUNIT_ASSERT_EQUAL(std::string("alice:ium8"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); req->setUrl("http://localhost/documents2/manual.html"); CPPUNIT_ASSERT_EQUAL(std::string("myname:mypass"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); req->setUrl("http://localhost/doc/readme.txt"); CPPUNIT_ASSERT_EQUAL(std::string("myname:mypass"), - factory.createAuthConfig(req)->getAuthText()); + factory.createAuthConfig(req, &option)->getAuthText()); req->setUrl("http://local/"); - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); req->setUrl("http://mirror/"); - CPPUNIT_ASSERT(factory.createAuthConfig(req).isNull()); + CPPUNIT_ASSERT(factory.createAuthConfig(req, &option).isNull()); } } // namespace aria2 diff --git a/test/FtpConnectionTest.cc b/test/FtpConnectionTest.cc index bbbfab4f..5d636a40 100644 --- a/test/FtpConnectionTest.cc +++ b/test/FtpConnectionTest.cc @@ -43,7 +43,7 @@ public: void setUp() { _option.reset(new Option()); - _authConfigFactory.reset(new AuthConfigFactory(_option.get())); + _authConfigFactory.reset(new AuthConfigFactory()); //_ftpServerSocket.reset(new SocketCore()); SharedHandle listenSocket(new SocketCore()); @@ -64,7 +64,8 @@ public: _serverSocket.reset(listenSocket->acceptConnection()); _ftp.reset(new FtpConnection(1, _clientSocket, req, - _authConfigFactory->createAuthConfig(req), + _authConfigFactory->createAuthConfig + (req, _option.get()), _option.get())); } diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc index 0f370114..2df09ccb 100644 --- a/test/HttpRequestTest.cc +++ b/test/HttpRequestTest.cc @@ -43,7 +43,7 @@ public: { _option.reset(new Option()); _option->put(PREF_HTTP_AUTH_CHALLENGE, V_TRUE); - _authConfigFactory.reset(new AuthConfigFactory(_option.get())); + _authConfigFactory.reset(new AuthConfigFactory()); } void testGetStartByte(); @@ -135,7 +135,7 @@ void HttpRequestTest::testCreateRequest() httpRequest.setRequest(request); httpRequest.setSegment(segment); httpRequest.setFileEntry(fileEntry); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); // remove "Connection: close" and add end byte range request->setPipeliningHint(true); @@ -236,7 +236,8 @@ void HttpRequestTest::testCreateRequest() _option->put(PREF_HTTP_USER, "aria2user"); _option->put(PREF_HTTP_PASSWD, "aria2passwd"); - CPPUNIT_ASSERT(_authConfigFactory->activateBasicCred("localhost", "/")); + CPPUNIT_ASSERT(_authConfigFactory->activateBasicCred + ("localhost", "/", _option.get())); expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" "User-Agent: aria2\r\n" @@ -327,7 +328,7 @@ void HttpRequestTest::testCreateRequest_ftp() httpRequest.setRequest(request); httpRequest.setSegment(segment); httpRequest.setFileEntry(fileEntry); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); httpRequest.setProxyRequest(proxyRequest); std::string expectedText = @@ -393,7 +394,7 @@ void HttpRequestTest::testCreateRequest_with_cookie() httpRequest.setSegment(segment); httpRequest.setFileEntry(fileEntry); httpRequest.setCookieStorage(st); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" "User-Agent: aria2\r\n" @@ -459,7 +460,7 @@ void HttpRequestTest::testCreateRequest_query() HttpRequest httpRequest; httpRequest.disableContentEncoding(); httpRequest.setRequest(request); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); std::string expectedText = "GET /wiki?id=9ad5109a-b8a5-4edf-9373-56a1c34ae138 HTTP/1.1\r\n" @@ -482,7 +483,7 @@ void HttpRequestTest::testCreateRequest_head() HttpRequest httpRequest; httpRequest.setRequest(request); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); std::stringstream result(httpRequest.createRequest()); std::string line; @@ -623,7 +624,7 @@ void HttpRequestTest::testUserAgent() httpRequest.setRequest(request); //httpRequest.setSegment(segment); httpRequest.setUserAgent("aria2 (Linux)"); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" "User-Agent: aria2 (Linux)\r\n" @@ -658,7 +659,7 @@ void HttpRequestTest::testAddHeader() HttpRequest httpRequest; httpRequest.disableContentEncoding(); httpRequest.setRequest(request); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); httpRequest.addHeader("X-ARIA2: v0.13\nX-ARIA2-DISTRIBUTE: enabled\n"); std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" @@ -686,7 +687,7 @@ void HttpRequestTest::testAddAcceptType() HttpRequest httpRequest; httpRequest.disableContentEncoding(); httpRequest.setRequest(request); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); httpRequest.addAcceptType(&acceptTypes[0], &acceptTypes[arrayLength(acceptTypes)]); @@ -710,7 +711,7 @@ void HttpRequestTest::testEnableAcceptEncoding() HttpRequest httpRequest; httpRequest.setRequest(request); - httpRequest.setAuthConfigFactory(_authConfigFactory); + httpRequest.setAuthConfigFactory(_authConfigFactory, _option.get()); std::string acceptEncodings; #ifdef HAVE_LIBZ