fix(http): is_valid_method expects &-ptr
This commit is contained in:
@@ -6,7 +6,7 @@ use std::io::net::ip::Ipv4Addr;
|
|||||||
static PHRASE: &'static [u8] = b"Hello World!";
|
static PHRASE: &'static [u8] = b"Hello World!";
|
||||||
|
|
||||||
fn hyper_handle(mut incoming: hyper::server::Incoming) {
|
fn hyper_handle(mut incoming: hyper::server::Incoming) {
|
||||||
let mut pool = TaskPool::new(100);
|
let pool = TaskPool::new(100);
|
||||||
|
|
||||||
for conn in incoming {
|
for conn in incoming {
|
||||||
pool.execute(proc() {
|
pool.execute(proc() {
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ pub fn read_method<R: Reader>(stream: &mut R) -> HttpResult<method::Method> {
|
|||||||
|
|
||||||
match (maybe_method, buf[]) {
|
match (maybe_method, buf[]) {
|
||||||
(Some(method), _) => Ok(method),
|
(Some(method), _) => Ok(method),
|
||||||
(None, ext) if is_valid_method(buf) => {
|
(None, ext) if is_valid_method(&buf) => {
|
||||||
use std::str::raw;
|
use std::str::raw;
|
||||||
// We already checked that the buffer is ASCII
|
// We already checked that the buffer is ASCII
|
||||||
Ok(method::Method::Extension(unsafe { raw::from_utf8(ext) }.trim().into_string()))
|
Ok(method::Method::Extension(unsafe { raw::from_utf8(ext) }.trim().into_string()))
|
||||||
|
|||||||
Reference in New Issue
Block a user