From 1d71626bea62f10e723609e32dce46fb86179749 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 20 Jan 2011 00:25:01 +0900 Subject: Supported multi-line HTTP header field value. See http://tools.ietf.org/html/rfc2616#section-4.2 --- src/HttpHeader.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/HttpHeader.cc') diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 9e191ab1..a4158dff 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -193,14 +193,25 @@ void HttpHeader::setRequestPath(const std::string& requestPath) void HttpHeader::fill(std::istream& in) { std::string line; - while(std::getline(in, line)) { + std::getline(in, line); + while(in) { line = util::strip(line); if(line.empty()) { - continue; + std::getline(in, line); + } else { + std::pair hp; + util::divide(hp, line, ':'); + while(std::getline(in, line)) { + if(!line.empty() && (line[0] == ' ' || line[0] == '\t')) { + line = util::strip(line); + hp.second += " "; + hp.second += line; + } else { + break; + } + } + put(hp.first, hp.second); } - std::pair hp; - util::divide(hp, line, ':'); - put(hp.first, hp.second); } } -- cgit