Skip to content

Commit f3e1bae

Browse files
committed
fix(http): is_valid_method expects &-ptr
1 parent 35b7ec1 commit f3e1bae

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/hello.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::io::net::ip::Ipv4Addr;
66
static PHRASE: &'static [u8] = b"Hello World!";
77

88
fn hyper_handle(mut incoming: hyper::server::Incoming) {
9-
let mut pool = TaskPool::new(100);
9+
let pool = TaskPool::new(100);
1010

1111
for conn in incoming {
1212
pool.execute(proc() {

src/http.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ pub fn read_method<R: Reader>(stream: &mut R) -> HttpResult<method::Method> {
327327
let mut buf = [SP, ..16];
328328

329329
if !try!(read_until_space(stream, &mut buf)) {
330-
return Err(HttpMethodError);
330+
return Err(HttpMethodError);
331331
}
332332

333333
debug!("method buf = {}", buf[].to_ascii());
334-
334+
335335
let maybe_method = match buf[0..7] {
336336
b"GET " => Some(method::Method::Get),
337337
b"PUT " => Some(method::Method::Put),
@@ -349,7 +349,7 @@ pub fn read_method<R: Reader>(stream: &mut R) -> HttpResult<method::Method> {
349349

350350
match (maybe_method, buf[]) {
351351
(Some(method), _) => Ok(method),
352-
(None, ext) if is_valid_method(buf) => {
352+
(None, ext) if is_valid_method(&buf) => {
353353
use std::str::raw;
354354
// We already checked that the buffer is ASCII
355355
Ok(method::Method::Extension(unsafe { raw::from_utf8(ext) }.trim().into_string()))
@@ -629,7 +629,7 @@ mod tests {
629629
fn mem(s: &str) -> MemReader {
630630
MemReader::new(s.as_bytes().to_vec())
631631
}
632-
632+
633633
#[test]
634634
fn test_read_method() {
635635
fn read(s: &str, m: method::Method) {

0 commit comments

Comments
 (0)