我在 golang 上使用簡單的客戶端
package main
import (
"fmt"
"net/http"
)
func main() {
_, err := http.Get("http://localhost:8080/health")
fmt.Println(err)
}
和 python 上的簡單 http 服務器https://gist.github.com/huyng/814831
但我有一個錯誤
Get "http://localhost:8080/health": net/http: HTTP/1.x transport connection broken: unexpected EOF
我的客戶端或服務器出了什么問題?
uj5u.com熱心網友回復:
...net/http: HTTP/1.x transport connection broken: unexpected EOF我的客戶端或服務器出了什么問題?
答案就在您用于服務器的代碼下方的 6 年前的評論中:
好的。但是,由于沒有 self.end_headers() 存在一個小的 HTTP 協議故障,因此在提供給挑剔的客戶端(haproxy)時回應格式不正確。;)
因此,不要僅僅從互聯網上的某個地方獲取代碼,而不了解它的作用。特別是,如果已經有明確的評論說代碼被破壞了
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/514601.html
標籤:去
下一篇:"error":"在方案\"pkg/runtime/scheme.go:100\""}中沒有為v1.ServiceMonitor型別注冊
