fix http proxy response
This commit is contained in:
parent
b99292bed8
commit
74dc03bd66
@ -164,11 +164,16 @@ func (h *httpHandler) handleRequest(ctx context.Context, conn net.Conn, req *htt
|
||||
ProtoMajor: 1,
|
||||
ProtoMinor: 1,
|
||||
Header: h.md.header,
|
||||
ContentLength: -1,
|
||||
}
|
||||
if resp.Header == nil {
|
||||
resp.Header = http.Header{}
|
||||
}
|
||||
|
||||
if resp.Header.Get("Proxy-Agent") == "" {
|
||||
resp.Header.Set("Proxy-Agent", h.md.proxyAgent)
|
||||
}
|
||||
|
||||
clientID, ok := h.authenticate(ctx, conn, req, resp, log)
|
||||
if !ok {
|
||||
return nil
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
|
||||
const (
|
||||
defaultRealm = "gost"
|
||||
defaultProxyAgent = "gost/3.0"
|
||||
)
|
||||
|
||||
type metadata struct {
|
||||
@ -20,6 +21,7 @@ type metadata struct {
|
||||
hash string
|
||||
authBasicRealm string
|
||||
observePeriod time.Duration
|
||||
proxyAgent string
|
||||
}
|
||||
|
||||
func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
|
||||
@ -46,6 +48,11 @@ func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
|
||||
|
||||
h.md.observePeriod = mdutil.GetDuration(md, "observePeriod")
|
||||
|
||||
h.md.proxyAgent = mdutil.GetString(md, "http.proxyAgent", "proxyAgent")
|
||||
if h.md.proxyAgent == "" {
|
||||
h.md.proxyAgent = defaultProxyAgent
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user