Git Product home page Git Product logo

Comments (11)

igrigorik avatar igrigorik commented on June 16, 2024

Federico, which version of rack are you on? Seems to be a-ok on this end (running with rack 1.2.1, but it could also be something else..).

from goliath.

razielgn avatar razielgn commented on June 16, 2024

I have rack 1.2.1 in my gemset, but to be sure I created a new gemset and ran just "gem install goliath".

"gem list" output:
async-rack (0.5.1)
em-synchrony (0.3.0.beta.1)
eventmachine (1.0.0.beta.3)
goliath (0.9.0)
http_parser.rb (0.5.1)
log4r (1.1.9)
mkrf (0.2.3)
multi_json (0.0.5)
rack (1.2.1)
rack-accept-media-types (0.9)
rack-contrib (1.1.0)
rack-respond_to (0.9.8)
rake (0.8.7)
rubygems-update (1.4.2)

The problem persists: 404 on every request on those two examples.

I'm running ruby 1.9.2-p136 built with RVM on macosx 10.6.6.

from goliath.

dj2 avatar dj2 commented on June 16, 2024

I wonder if this is a Ruby version issue. I created a fresh gemset and did gem install goliath on MacOSX 10.6.6 and the examples run correctly.

The difference is, I have 1.9.2p0. Let me try upgrading my ruby to a higher patch level and see what happens.

dj2@Magnus:~/Development/Goliath [master]$ ./examples/custom_server.rb -sv
[85426:INFO] 2011-03-09 12:22:07 :: Starting server on 0.0.0.0:9000 in development mode. Watch out for stones.
[85426:INFO] 2011-03-09 12:22:09 :: Status: 200, Content-Length: 11, Response Time: 3.30ms
[85426:INFO] 2011-03-09 12:22:14 :: Status: 200, Content-Length: 12, Response Time: 0.45ms

dj2@Magnus:~ $ curl localhost:9000
Try /version /hello_world or /bonjour
dj2@Magnus:~ $ curl localhost:9000/version
Version 0.1
dj2@Magnus:~ $ curl localhost:9000/hello_world
hello world!

from goliath.

dj2 avatar dj2 commented on June 16, 2024

Upgraded to -p180 and it seems to be working here. Will install -head and see if that gives different results

from goliath.

dj2 avatar dj2 commented on June 16, 2024

I tried with ruby-head and everything seems to be working with that as well. Refreshing myself on the code, if you don't request for /version, /hello_world or /bonjour it will return a 404 with information on the correct URLs to query.

Does querying localhost:9000/version return version 0.1 with a 200 response?

from goliath.

razielgn avatar razielgn commented on June 16, 2024

I upgraded to -p180 and it works fine.
Previously with -p136 I tried /version, /bonjour, ecc. and gave 404 "Not found: /version", 404 "Not found: /bonjour", ecc.
Thanks for your help.

from goliath.

razielgn avatar razielgn commented on June 16, 2024

I discovered the real problem: it doesn't work if I enter the address manually (such as 127.0.0.1:9000 or 192.168.1.12:9000), as I did before with -p136.
It works just with localhost:9000. Probably related to my machine.

from goliath.

dj2 avatar dj2 commented on June 16, 2024

Interesting, I'm seeing the same behaviour when using 127.0.0.1 with the custom_server example. This works correctly with hello_world example so I wonder if something is going strange with the information we're providing to the rack mapper.

Will see what I can figure out.

from goliath.

dj2 avatar dj2 commented on June 16, 2024

I took a deeper look into this and I think it's just the way Rack::URLMap works (which is what's used behind the scenes when you call map in a Rack::Builder block).

Each match either has a host attached or the host is set to nil. (In our case, host is nil as we don't provide one). If the host is nil then Rack::URLMap requires that the HTTP Host header match either the SERVER_NAME or SERVER_NAME + SERVER_PORT.

For us, the Host header will be set to 127.0.0.1:9000 when you make the request. For Goliath, the SERVER_NAME is always set to 'localhost'. So, when it does the comparison, 127.0.0.1:9000 fails to match localhost:9000 and it doesn't match the URL.

I don't see anyway to make this work so I'm closing the bug. If I'm missing something please let me know.

from goliath.

igrigorik avatar igrigorik commented on June 16, 2024

Dan, it sounds like SERVER_NAME should be initialized to the address specified at startup time, or defaulted to LOCALHOST if -a is not present. I think this is a legitimate bug and something we need to fix.

from goliath.

dj2 avatar dj2 commented on June 16, 2024

K, created a new bug for that issue. #13

from goliath.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.