mirror of https://github.com/aria2/aria2
2008-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that metalink file is not processed if Content-Type field has a paramter. * src/HttpResponse.cc * src/HttpResponse.h * test/HttpResponseTest.ccpull/1/head
parent
bb8481e752
commit
82b80c33d8
|
@ -1,3 +1,11 @@
|
||||||
|
2008-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Fixed the bug that metalink file is not processed if Content-Type
|
||||||
|
field has a paramter.
|
||||||
|
* src/HttpResponse.cc
|
||||||
|
* src/HttpResponse.h
|
||||||
|
* test/HttpResponseTest.cc
|
||||||
|
|
||||||
2008-11-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2008-11-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Removed unused code.
|
Removed unused code.
|
||||||
|
|
|
@ -212,7 +212,8 @@ std::string HttpResponse::getContentType() const
|
||||||
if(httpHeader.isNull()) {
|
if(httpHeader.isNull()) {
|
||||||
return A2STR::NIL;
|
return A2STR::NIL;
|
||||||
} else {
|
} else {
|
||||||
return httpHeader->getFirst(HttpHeader::CONTENT_TYPE);
|
return
|
||||||
|
Util::split(httpHeader->getFirst(HttpHeader::CONTENT_TYPE), ";").first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
|
|
||||||
uint64_t getEntityLength() const;
|
uint64_t getEntityLength() const;
|
||||||
|
|
||||||
|
// Returns type "/" subtype. The parameter is removed.
|
||||||
std::string getContentType() const;
|
std::string getContentType() const;
|
||||||
|
|
||||||
void setHttpHeader(const SharedHandle<HttpHeader>& httpHeader);
|
void setHttpHeader(const SharedHandle<HttpHeader>& httpHeader);
|
||||||
|
|
|
@ -122,9 +122,10 @@ void HttpResponseTest::testGetContentType()
|
||||||
{
|
{
|
||||||
HttpResponse httpResponse;
|
HttpResponse httpResponse;
|
||||||
SharedHandle<HttpHeader> httpHeader(new HttpHeader());
|
SharedHandle<HttpHeader> httpHeader(new HttpHeader());
|
||||||
httpHeader->put("content-type", "application/octet-stream");
|
httpHeader->put("content-type", "application/metalink+xml; charset=UTF-8");
|
||||||
httpResponse.setHttpHeader(httpHeader);
|
httpResponse.setHttpHeader(httpHeader);
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("application/octet-stream"),
|
// See paramter is ignored.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string("application/metalink+xml"),
|
||||||
httpResponse.getContentType());
|
httpResponse.getContentType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue