Skip to content

Commit

Permalink
fix(server): Removed check for GET/HEAD request when parsing body
Browse files Browse the repository at this point in the history
Fixes #698
  • Loading branch information
kaedroho committed Nov 29, 2015
1 parent 3f1b13c commit 0b05c59
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/server/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::time::Duration;
use buffer::BufReader;
use net::NetworkStream;
use version::{HttpVersion};
use method::Method::{self, Get, Head};
use method::Method;
use header::{Headers, ContentLength, TransferEncoding};
use http::h1::{self, Incoming, HttpReader};
use http::h1::HttpReader::{SizedReader, ChunkedReader, EmptyReader};
Expand Down Expand Up @@ -41,9 +41,7 @@ impl<'a, 'b: 'a> Request<'a, 'b> {
debug!("Request Line: {:?} {:?} {:?}", method, uri, version);
debug!("{:?}", headers);

let body = if method == Get || method == Head {
EmptyReader(stream)
} else if headers.has::<ContentLength>() {
let body = if headers.has::<ContentLength>() {
match headers.get::<ContentLength>() {
Some(&ContentLength(len)) => SizedReader(stream, len),
None => unreachable!()
Expand Down

0 comments on commit 0b05c59

Please sign in to comment.