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

Browsing http://localhost:5000 causes binary file to be downloaded #8

Closed
tony19 opened this issue Jun 18, 2016 · 1 comment
Closed

Comments

@tony19
Copy link

tony19 commented Jun 18, 2016

Description

After starting simplehttp2server, the console shows Listening on :5000.... If we forget that it's serving over https and try to access http://localhost:5000, a binary file gets downloaded.

Steps to Reproduce

  1. CD into directory containing index.html
  2. Run simplehttp2server.
  3. Browse to http://localhost:5000 (instead of https).

Expected Results

  • Server log shows full URL (i.e., Listening on https://localhost:5000)
  • or any of the following:
    • Redirect to https (301)
    • Serve the index.html (unencrypted h2 preferably, or even http/1.1)
    • Display a meaningful/helpful error page
    • Display a meaningful/helpful error on the terminal's server log

Actual Results

  • Binary file is downloaded instead of a page shown in browser
  • Server log emits cryptic (at least for someone unfamiliar with TLS) error:
2016/06/17 22:12:43 http: TLS handshake error from [::1]:54431: tls: first record does not look like a TLS handshake

Environment

x Version
Operating System OS X El Capitan
Go go version go1.6.2 darwin/amd64
Shell zsh
Browser Chrome 51
@surma
Copy link
Contributor

surma commented Jun 21, 2016

Yes, I have not quite figured out what to do abut that. The reason this is happening is that the browser tries to connect with TLS on a non-TLS port. I don’t want to add support for unencrypted http/1.1 because this is not a production server anyways and it should be obvious right away if you are not successfully using h2. A custom error page would be a good idea, but I don’t think I can serve both HTTP and HTTP/2 on the same port. I’ll investigate.

Server log shows full URL
That is a good remark. Will add.

@surma surma closed this as completed in b451581 Jun 21, 2016
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

2 participants