Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I use the Rack handler? #6

Open
rkh opened this issue May 13, 2012 · 4 comments
Open

How do I use the Rack handler? #6

rkh opened this issue May 13, 2012 · 4 comments

Comments

@rkh
Copy link

rkh commented May 13, 2012

rackup -s HTTP doesn't work (I think rack is trying to load rack/handler/hTTP.rb), neither does rackup -s http, as you don't call register in the handler.

@postmodern
Copy link
Owner

Hmm rackup -s HTTP works for me (net-http-server 0.2.1). Although, it's returning Chunked Transfer-Encoding lines.

@zhengjia
Copy link

zhengjia commented Jun 9, 2012

Isn't Transfer-Encoding a response header?

@postmodern
Copy link
Owner

Here's what I'm seeing with net-http-server 0.2.1 and rack 1.4.1:

run lambda { |env|
  [200, {'Content-Type' => 'text/html'}, ['hello world']]
}
$ rackup -s HTTP
$ curl -v http://localhost:9292/
* About to connect() to localhost port 9292 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 9292 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7
> Host: localhost:9292
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html
< Transfer-Encoding: chunked
< 
b
hello world
0

* Connection #0 to host localhost left intact
* Closing connection #0

@postmodern
Copy link
Owner

Ah it appears Rack is doing it's own Chunked Encoding:

T 127.0.0.1:49996 -> 127.0.0.1:9292 [AP]
  GET / HTTP/1.1..Accept: */*..User-Agent: Ruby..Host: localhost:9292....              
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  HTTP/1.1 200 OK..                                                                    
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  Content-Type: text/html..                                                            
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  Transfer-Encoding: chunked..                                                         
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  ..                                                                                   
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  10..                                                                                 
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  b..hello world..                                                                     
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  ..                                                                                   
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  5..                                                                                  
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  0....                                                                                
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  ..                                                                                   
##
T 127.0.0.1:9292 -> 127.0.0.1:49996 [AP]
  0....                                                                                

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants