Allow IPFS server to accept POST requests
This commit is contained in:
parent
8d04dffe69
commit
649de53382
@ -77,11 +77,11 @@ impl IpfsHandler {
|
|||||||
/// Implement Hyper's HTTP handler
|
/// Implement Hyper's HTTP handler
|
||||||
impl Handler<HttpStream> for IpfsHandler {
|
impl Handler<HttpStream> for IpfsHandler {
|
||||||
fn on_request(&mut self, req: Request<HttpStream>) -> Next {
|
fn on_request(&mut self, req: Request<HttpStream>) -> Next {
|
||||||
if *req.method() != Method::Get {
|
match *req.method() {
|
||||||
return Next::write();
|
Method::Get | Method::Post => {},
|
||||||
|
_ => return Next::write()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if !http::is_host_allowed(&req, &self.allowed_hosts) {
|
if !http::is_host_allowed(&req, &self.allowed_hosts) {
|
||||||
self.out = Out::Bad("Disallowed Host header");
|
self.out = Out::Bad("Disallowed Host header");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user