Skip to content

Commit 5b3ff8f

Browse files
optout21philippem
authored andcommitted
Use case-insenitive match for HTTP header (Content-Length extraction)
1 parent 8915a40 commit 5b3ff8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/daemon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl Connection {
271271
} else if in_header {
272272
let parts: Vec<&str> = line.splitn(2, ": ").collect();
273273
if parts.len() == 2 {
274-
headers.insert(parts[0].to_owned(), parts[1].to_owned());
274+
headers.insert(parts[0].to_lowercase(), parts[1].to_owned());
275275
} else {
276276
warn!("invalid header: {:?}", line);
277277
}
@@ -284,7 +284,7 @@ impl Connection {
284284
let contents =
285285
contents.chain_err(|| ErrorKind::Connection("no reply from daemon".to_owned()))?;
286286
let contents_length: &str = headers
287-
.get("Content-Length")
287+
.get("content-length")
288288
.chain_err(|| format!("Content-Length is missing: {:?}", headers))?;
289289
let contents_length: usize = contents_length
290290
.parse()

0 commit comments

Comments
 (0)