Created
August 7, 2015 20:23
-
-
Save vanhecke/e2072de8716b5539a160 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Works fine in browser and using wget. | |
| # Using curl: | |
| # ⊨ curl -v http://127.0.0.1:8080/ ~ | |
| # * Hostname was NOT found in DNS cache | |
| # * Trying 127.0.0.1... | |
| # * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) | |
| # > GET / HTTP/1.1 | |
| # > User-Agent: curl/7.37.1 | |
| # > Host: 127.0.0.1:8080 | |
| # > Accept: */* | |
| # > Referer: | |
| # > | |
| # * Empty reply from server | |
| # * Connection #0 to host 127.0.0.1 left intact | |
| # curl: (52) Empty reply from server | |
| # | |
| # | |
| # In crystal app: | |
| # Unhandled exception: closed stream | |
| require "http/server" | |
| begin | |
| server = HTTP::Server.new(8080) do |request| | |
| HTTP::Response.ok "text/plain", "Hello Web!" | |
| end | |
| server.listen | |
| rescue ex # Doesn't catch the ex | |
| puts "Exception..." | |
| puts ex.message | |
| end |
Author
vanhecke
commented
Aug 8, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment