Skip to content

Commit

Permalink
The HTTP client uses parseRfc5322Header() now instead of doing custom…
Browse files Browse the repository at this point in the history
… parsing.
  • Loading branch information
s-ludwig committed May 25, 2012
1 parent 28ba2df commit 6230af0
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions source/vibe/http/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public import vibe.http.common;
import vibe.core.core;
import vibe.core.log;
import vibe.data.json;
import vibe.inet.rfc5322;
import vibe.inet.url;
import vibe.stream.ssl;
import vibe.stream.zlib;
Expand Down Expand Up @@ -135,17 +136,9 @@ class HttpClient {
}

// read headers until an empty line is hit
while(true){
string ln = cast(string)m_stream.readLine(MaxHttpHeaderLineLength);
logTrace("hdr: %s", ln);
if( ln.length == 0 ) break;
auto idx = ln.indexOf(":");
auto name = ln[0 .. idx];
ln = stripLeft(ln[idx+1 .. $]);
if( auto ph = name in res.headers ) *ph ~= ", " ~ ln;
else res.headers[name] = ln;
}
parseRfc5322Header(m_stream, res.headers, MaxHttpHeaderLineLength);

// prepare body the reader
if( req.method == "HEAD" ){
res.bodyReader = new LimitedInputStream(null, 0);
} else {
Expand Down

0 comments on commit 6230af0

Please sign in to comment.