Merge branch 'master' into bs/cell-blobpool/sparse-v2

This commit is contained in:
Bosul Mun 2026-05-18 16:46:28 +02:00 committed by GitHub
commit f4577def19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View file

@ -463,6 +463,7 @@ func (h *virtualHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Either invalid (too many colons) or no port specified // Either invalid (too many colons) or no port specified
host = r.Host host = r.Host
} }
host = strings.ToLower(host)
if ipAddr := net.ParseIP(host); ipAddr != nil { if ipAddr := net.ParseIP(host); ipAddr != nil {
// It's an IP address, we can serve that // It's an IP address, we can serve that
h.next.ServeHTTP(w, r) h.next.ServeHTTP(w, r)

View file

@ -60,6 +60,9 @@ func TestVhosts(t *testing.T) {
resp := rpcRequest(t, url, testMethod, "host", "test") resp := rpcRequest(t, url, testMethod, "host", "test")
assert.Equal(t, resp.StatusCode, http.StatusOK) assert.Equal(t, resp.StatusCode, http.StatusOK)
respUpper := rpcRequest(t, url, testMethod, "host", "TeSt:1234")
assert.Equal(t, respUpper.StatusCode, http.StatusOK)
resp2 := rpcRequest(t, url, testMethod, "host", "bad") resp2 := rpcRequest(t, url, testMethod, "host", "bad")
assert.Equal(t, resp2.StatusCode, http.StatusForbidden) assert.Equal(t, resp2.StatusCode, http.StatusForbidden)
} }

View file

@ -196,8 +196,9 @@ func MetadataFromContext(ctx context.Context) Metadata {
if info.Transport != "" { if info.Transport != "" {
if info.Transport == "http" { if info.Transport == "http" {
m.Scheme = info.HTTP.Version m.Scheme = info.HTTP.Version
} else {
m.Scheme = info.Transport
} }
m.Scheme = info.Transport
} }
if info.RemoteAddr != "" { if info.RemoteAddr != "" {
m.Remote = info.RemoteAddr m.Remote = info.RemoteAddr