Comments (15)
As further info, I can add that a dtruss indicates that both bind
, listen
and accept
get called, after which select
is called from inside sys_common::net::await
(the standard Rust TCP stack).
from hyper.
can you run your server with RUST_LOG=hyper=debug
?
from hyper.
Sure thing:
$ RUST_LOG=hyper=debug target/rust-web
DEBUG:hyper::::server: binding to 127.0.0.1:3000
And that's itβ¦ π¦
EDIT: Trying to connect produces no additional output.
from hyper.
Hm, it may not even be getting through the TCP layer.
Does the example in the TCP docs work? http://doc.rust-lang.org/std/io/net/tcp/struct.TcpListener.html
from hyper.
Hm, it does not! That would suggest a bug in Rust, right?
from hyper.
I believe so!
from hyper.
Wait a second, my mistake β the example from TcpListener does in fact work (as opposed to my telnet
invocation skills). The following outputs "Hello, World!" to a connecting telnet instance:
fn main() {
let listener = TcpListener::bind("127.0.0.1:3000");
// bind the listener to the specified address
let mut acceptor = listener.listen();
fn handle_client(mut stream: TcpStream) {
stream.write(b"Hello, World!");
}
// accept connections and process them, spawning a new tasks for each one
for stream in acceptor.incoming() {
match stream {
Err(e) => { /* connection failed */ }
Ok(stream) => spawn(proc() {
// connection succeeded
handle_client(stream)
})
}
}
// close the socket server
drop(acceptor);
}
from hyper.
Oh ok. So, the request with curl just says connection refused, but the server doesn't crash nor output any more info?
from hyper.
Exactly.
from hyper.
So, it should either output DEBUG: incoming stream or an ERROR: connection failed: https://github.com/hyperium/hyper/blob/master/src/server/mod.rs#L103
If it's not getting there, I'm left wondering if the error is happening inside rust-intertwine...
from hyper.
As you can probably tell, I'm new to Rust, but I'd be happy to help debugging in whatever ways I can. But I guess first of all: Are you or anyone else able to reproduce this behaviour?
from hyper.
I'm able to access the example server with cargo run --example server
and can curl it.
from hyper.
Alright, I had the same issue with the example, but then I tried curl
with a Rails app I had lying around, and it gave the same result. Apparently curl fails on all requests to localhost on my machine. wget
and browsers work without issue. I have no clue as to why I'm seeing this behaviour, but the problem seems to be with curl, and neither Rust nor Hyper.
It seems I had the following line in my /etc/hosts
:
::1 localhost
which caused curl to attempt an IPv6 connection to localhost, which neither Rust nor Ruby were listening on.
from hyper.
Whew. Glad it's worked out.
On Mon, Nov 10, 2014, 11:30 AM Simon Ask Ulsnes [email protected]
wrote:
Alright, I had the same issue with the example, but then I tried curl
with a Rails app I had lying around, and it gave the same result.
Apparently curl fails on all requests to localhost on my machine. wget
and browsers work without issue. I have no clue as to why I'm seeing this
behaviour, but the problem seems to be with curl, and neither Rust nor
Hyper.It seems I had the following line in my /etc/hosts:
::1 localhost
which caused curl to attempt an IPv6 connection to localhost, which
neither Rust nor Ruby were listening on.β
Reply to this email directly or view it on GitHub
#109 (comment).
from hyper.
Me too β really, really sorry to have wasted your time!
from hyper.
Related Issues (20)
- provide more context of opaque hyper errors HOT 1
- Unable to find Tower middleware signature constraints that works with both Axum and Hyper
- Add the ability to safely read into ReadBuf HOT 2
- hyper-util: Add a version of conn::auto that doesn't need to read the version
- http2 without ssl/tls not working HOT 2
- Examples should not use `support::TokioIo` HOT 1
- run example failed because of http-body HOT 1
- Change client example to only pass uri.path() HOT 1
- How to serve HTTP/1.1 and HTTP/2 on the same port in hyper 1.x HOT 1
- Receiving chunk extensions in HTTP/1.1 chunked encoding HOT 2
- http1 Connection no longer Send in 1.0 HOT 2
- Partial connection close via `SendRequest` HOT 2
- help: how to shutdown TCP connection
- target `wasm32-wasi` would require a `edition` bump or `resolver = "2"`
- [question] How to disable certificate verification for https client
- Help with Frame Mapping HOT 5
- Data race while re-using IDLE connection, connection reset by peer HOT 4
- Missing safety comment: which variants are upheld? HOT 1
- Sleep::downcast_mut_pin() should not extend lifetime HOT 1
- need help hyper::Error(User(ManualUpgrade))
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyper.