mirror of https://github.com/aria2/aria2
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made keyName static const. Made trimmed charset static const std::string. * src/Util.cc (getContentDispositionFilename)pull/1/head
parent
29d5651cd5
commit
87984328c5
|
@ -1,3 +1,9 @@
|
||||||
|
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Made keyName static const. Made trimmed charset static const
|
||||||
|
std::string.
|
||||||
|
* src/Util.cc (getContentDispositionFilename)
|
||||||
|
|
||||||
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Made USER_AGENT const. Made "/" static const std::string.
|
Made USER_AGENT const. Made "/" static const std::string.
|
||||||
|
|
|
@ -513,12 +513,12 @@ IntSequence Util::parseIntRange(const std::string& src)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Util::getContentDispositionFilename(const std::string& header) {
|
std::string Util::getContentDispositionFilename(const std::string& header) {
|
||||||
std::string keyName = "filename=";
|
static const std::string keyName = "filename=";
|
||||||
std::string::size_type attributesp = header.find(keyName);
|
std::string::size_type attributesp = header.find(keyName);
|
||||||
if(attributesp == std::string::npos) {
|
if(attributesp == std::string::npos) {
|
||||||
return A2STR::NIL;
|
return A2STR::NIL;
|
||||||
}
|
}
|
||||||
std::string::size_type filenamesp = attributesp+strlen(keyName.c_str());
|
std::string::size_type filenamesp = attributesp+keyName.size();
|
||||||
std::string::size_type filenameep;
|
std::string::size_type filenameep;
|
||||||
if(filenamesp == header.size()) {
|
if(filenamesp == header.size()) {
|
||||||
return A2STR::NIL;
|
return A2STR::NIL;
|
||||||
|
@ -533,7 +533,8 @@ std::string Util::getContentDispositionFilename(const std::string& header) {
|
||||||
if(filenameep == std::string::npos) {
|
if(filenameep == std::string::npos) {
|
||||||
filenameep = header.size();
|
filenameep = header.size();
|
||||||
}
|
}
|
||||||
return trim(header.substr(filenamesp, filenameep-filenamesp), "\r\n '\"");
|
static const std::string TRIMMED("\r\n '\"");
|
||||||
|
return trim(header.substr(filenamesp, filenameep-filenamesp), TRIMMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nbits[] = {
|
static int nbits[] = {
|
||||||
|
|
Loading…
Reference in New Issue