Created
August 7, 2015 20:23
-
-
Save vanhecke/e2072de8716b5539a160 to your computer and use it in GitHub Desktop.
This file contains 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 |
$ curl --version
curl 7.30.0 (x86_64-apple-darwin13.0) libcurl/7.30.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz
⊨ curl --version ~
curl 7.37.1 (x86_64-apple-darwin14.0) libcurl/7.37.1 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get