Fix a crash when parsing empty HTTP headers

This commit is contained in:
Peter Thorson
2014-01-26 19:39:55 -06:00
parent 4393a2562b
commit e44463583b
3 changed files with 6 additions and 0 deletions

View File

@@ -369,6 +369,9 @@ InputIterator extract_parameters(InputIterator begin, InputIterator end,
inline std::string strip_lws(std::string const & input) {
std::string::const_iterator begin = extract_all_lws(input.begin(),input.end());
if (begin == input.end()) {
return std::string();
}
std::string::const_reverse_iterator end = extract_all_lws(input.rbegin(),input.rend());
return std::string(begin,end.base());