pull/150/head
Tatsuhiro Tsujikawa 2013-11-06 23:40:59 +09:00
parent 9f5fdb4e10
commit 2aa8e01836
4 changed files with 15 additions and 15 deletions

View File

@ -117,7 +117,7 @@ void HttpResponse::validateResponse() const
} }
} }
std::string HttpResponse::determinFilename() const std::string HttpResponse::determineFilename() const
{ {
std::string contentDisposition = util::getContentDispositionFilename( std::string contentDisposition = util::getContentDispositionFilename(
httpHeader_->find(HttpHeader::CONTENT_DISPOSITION)); httpHeader_->find(HttpHeader::CONTENT_DISPOSITION));

View File

@ -70,7 +70,7 @@ public:
* this function returns the filename from it. * this function returns the filename from it.
* If it is not there, returns the part of filename from the request URL. * If it is not there, returns the part of filename from the request URL.
*/ */
std::string determinFilename() const; std::string determineFilename() const;
void retrieveCookie(); void retrieveCookie();

View File

@ -254,7 +254,7 @@ bool HttpResponseCommand::executeInternal()
fe->setLength(totalLength); fe->setLength(totalLength);
if (fe->getPath().empty()) { if (fe->getPath().empty()) {
fe->setPath(util::createSafePath(getOption()->get(PREF_DIR), fe->setPath(util::createSafePath(getOption()->get(PREF_DIR),
httpResponse->determinFilename())); httpResponse->determineFilename()));
} }
fe->setContentType(httpResponse->getContentType()); fe->setContentType(httpResponse->getContentType());
grp->preDownloadProcessing(); grp->preDownloadProcessing();

View File

@ -32,9 +32,9 @@ class HttpResponseTest : public CppUnit::TestFixture {
//CPPUNIT_TEST(testGetContentLength_range); //CPPUNIT_TEST(testGetContentLength_range);
CPPUNIT_TEST(testGetEntityLength); CPPUNIT_TEST(testGetEntityLength);
CPPUNIT_TEST(testGetContentType); CPPUNIT_TEST(testGetContentType);
CPPUNIT_TEST(testDeterminFilename_without_ContentDisposition); CPPUNIT_TEST(testDetermineFilename_without_ContentDisposition);
CPPUNIT_TEST(testDeterminFilename_with_ContentDisposition_zero_length); CPPUNIT_TEST(testDetermineFilename_with_ContentDisposition_zero_length);
CPPUNIT_TEST(testDeterminFilename_with_ContentDisposition); CPPUNIT_TEST(testDetermineFilename_with_ContentDisposition);
CPPUNIT_TEST(testGetRedirectURI_without_Location); CPPUNIT_TEST(testGetRedirectURI_without_Location);
CPPUNIT_TEST(testGetRedirectURI_with_Location); CPPUNIT_TEST(testGetRedirectURI_with_Location);
CPPUNIT_TEST(testIsRedirect); CPPUNIT_TEST(testIsRedirect);
@ -67,9 +67,9 @@ public:
void testGetContentLength_contentLength(); void testGetContentLength_contentLength();
void testGetEntityLength(); void testGetEntityLength();
void testGetContentType(); void testGetContentType();
void testDeterminFilename_without_ContentDisposition(); void testDetermineFilename_without_ContentDisposition();
void testDeterminFilename_with_ContentDisposition_zero_length(); void testDetermineFilename_with_ContentDisposition_zero_length();
void testDeterminFilename_with_ContentDisposition(); void testDetermineFilename_with_ContentDisposition();
void testGetRedirectURI_without_Location(); void testGetRedirectURI_without_Location();
void testGetRedirectURI_with_Location(); void testGetRedirectURI_with_Location();
void testIsRedirect(); void testIsRedirect();
@ -143,7 +143,7 @@ void HttpResponseTest::testGetContentType()
httpResponse.getContentType()); httpResponse.getContentType());
} }
void HttpResponseTest::testDeterminFilename_without_ContentDisposition() void HttpResponseTest::testDetermineFilename_without_ContentDisposition()
{ {
HttpResponse httpResponse; HttpResponse httpResponse;
auto httpRequest = make_unique<HttpRequest>(); auto httpRequest = make_unique<HttpRequest>();
@ -155,10 +155,10 @@ void HttpResponseTest::testDeterminFilename_without_ContentDisposition()
httpResponse.setHttpRequest(std::move(httpRequest)); httpResponse.setHttpRequest(std::move(httpRequest));
CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"), CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"),
httpResponse.determinFilename()); httpResponse.determineFilename());
} }
void HttpResponseTest::testDeterminFilename_with_ContentDisposition_zero_length void HttpResponseTest::testDetermineFilename_with_ContentDisposition_zero_length
() ()
{ {
HttpResponse httpResponse; HttpResponse httpResponse;
@ -173,10 +173,10 @@ void HttpResponseTest::testDeterminFilename_with_ContentDisposition_zero_length
httpResponse.setHttpRequest(std::move(httpRequest)); httpResponse.setHttpRequest(std::move(httpRequest));
CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"), CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"),
httpResponse.determinFilename()); httpResponse.determineFilename());
} }
void HttpResponseTest::testDeterminFilename_with_ContentDisposition() void HttpResponseTest::testDetermineFilename_with_ContentDisposition()
{ {
HttpResponse httpResponse; HttpResponse httpResponse;
auto httpHeader = make_unique<HttpHeader>(); auto httpHeader = make_unique<HttpHeader>();
@ -191,7 +191,7 @@ void HttpResponseTest::testDeterminFilename_with_ContentDisposition()
httpResponse.setHttpRequest(std::move(httpRequest)); httpResponse.setHttpRequest(std::move(httpRequest));
CPPUNIT_ASSERT_EQUAL(std::string("aria2-current.tar.bz2"), CPPUNIT_ASSERT_EQUAL(std::string("aria2-current.tar.bz2"),
httpResponse.determinFilename()); httpResponse.determineFilename());
} }
void HttpResponseTest::testGetRedirectURI_without_Location() void HttpResponseTest::testGetRedirectURI_without_Location()