Comments (11)
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.
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.
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.
Upgraded to -p180 and it seems to be working here. Will install -head and see if that gives different results
from goliath.
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.
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.
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.
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.
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.
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.
K, created a new bug for that issue. #13
from goliath.
Related Issues (20)
- Does coerce still work?
- Validation Errors for Required Params are not a valid format HOT 4
- require grape slow down app HOT 5
- What's the purpose of Goliath.run_app_on_exit = true ? HOT 3
- Error after adding goliath to my Gemfile. HOT 4
- Getting issues in app due to lock/ compatibility between ruby 2.0.0 and goliath 1.0.3 HOT 2
- EM dependency too permissive HOT 9
- 1.0.5 release HOT 14
- Please join us in implementing Websockets for Rack HOT 1
- Store env in thread-local variable HOT 1
- Goliath JSON middleware incompatible with JSONAPI HOT 2
- Params middleware only parses params for `application/json` HOT 1
- How to stream content through a Goliath app? HOT 7
- Accessing the EventMachine connection? HOT 5
- Change message "An error happened"
- Sending response before all request data was received HOT 1
- Rack 2.x
- HTTP Request Smuggling Hardening
- Security Notice & Bug Bounty - HTTP Request Smuggling - huntr.dev HOT 1
- How to set allowed duplicated headers in Http Response HOT 2
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 goliath.