0

I use simple client on golang

package main

import (
    "fmt"
    "net/http"
)

func main() {
    _, err := http.Get("http://localhost:8080/health")
    fmt.Println(err)
}

and simple http server on python https://gist.github.com/huyng/814831

but I got an error

Get "http://localhost:8080/health": net/http: HTTP/1.x transport connection broken: unexpected EOF

What is wrong with my client or server?

1 Answer 1

-1
...net/http: HTTP/1.x transport connection broken: unexpected EOF 

What is wrong with my client or server?

The answer lies in the 6 year old comment immediately below the code you use for the server:

Nice. A minor HTTP protocol glitch though, as there's no self.end_headers() so the response is malformed when served to picky clients (haproxy). ;)

Thus, don't just take code from somewhere on the internet w/o understanding what it does. Especially, if there is already an explicitly comment saying that the code is broken

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.