mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-30 12:05:38 +00:00
Add configuration option: debug_http_headers
This commit is contained in:
@@ -220,6 +220,11 @@ func (c *Client) handlerFunc(w dns.ResponseWriter, r *dns.Msg, isTCP bool) {
|
||||
panic("Unknown request Content-Type")
|
||||
}
|
||||
|
||||
for _, header := range c.conf.DebugHTTPHeaders {
|
||||
if value:= req.response.Header.Get(header); value != "" {
|
||||
log.Printf("%s: %s\n", header, value)
|
||||
}
|
||||
}
|
||||
if req.err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -30,15 +30,16 @@ import (
|
||||
)
|
||||
|
||||
type config struct {
|
||||
Listen []string `toml:"listen"`
|
||||
UpstreamGoogle []string `toml:"upstream_google"`
|
||||
UpstreamIETF []string `toml:"upstream_ietf"`
|
||||
Bootstrap []string `toml:"bootstrap"`
|
||||
Timeout uint `toml:"timeout"`
|
||||
NoCookies bool `toml:"no_cookies"`
|
||||
NoECS bool `toml:"no_ecs"`
|
||||
NoIPv6 bool `toml:"no_ipv6"`
|
||||
Verbose bool `toml:"verbose"`
|
||||
Listen []string `toml:"listen"`
|
||||
UpstreamGoogle []string `toml:"upstream_google"`
|
||||
UpstreamIETF []string `toml:"upstream_ietf"`
|
||||
Bootstrap []string `toml:"bootstrap"`
|
||||
Timeout uint `toml:"timeout"`
|
||||
NoCookies bool `toml:"no_cookies"`
|
||||
NoECS bool `toml:"no_ecs"`
|
||||
NoIPv6 bool `toml:"no_ipv6"`
|
||||
Verbose bool `toml:"verbose"`
|
||||
DebugHTTPHeaders []string `toml:"debug_http_headers"`
|
||||
}
|
||||
|
||||
func loadConfig(path string) (*config, error) {
|
||||
|
||||
@@ -30,15 +30,16 @@ import (
|
||||
)
|
||||
|
||||
type config struct {
|
||||
Listen []string `toml:"listen"`
|
||||
Cert string `toml:"cert"`
|
||||
Key string `toml:"key"`
|
||||
Path string `toml:"path"`
|
||||
Upstream []string `toml:"upstream"`
|
||||
Timeout uint `toml:"timeout"`
|
||||
Tries uint `toml:"tries"`
|
||||
TCPOnly bool `toml:"tcp_only"`
|
||||
Verbose bool `toml:"verbose"`
|
||||
Listen []string `toml:"listen"`
|
||||
Cert string `toml:"cert"`
|
||||
Key string `toml:"key"`
|
||||
Path string `toml:"path"`
|
||||
Upstream []string `toml:"upstream"`
|
||||
Timeout uint `toml:"timeout"`
|
||||
Tries uint `toml:"tries"`
|
||||
TCPOnly bool `toml:"tcp_only"`
|
||||
Verbose bool `toml:"verbose"`
|
||||
DebugHTTPHeaders []string `toml:"debug_http_headers"`
|
||||
}
|
||||
|
||||
func loadConfig(path string) (*config, error) {
|
||||
|
||||
@@ -112,6 +112,13 @@ func (s *Server) handlerFunc(w http.ResponseWriter, r *http.Request) {
|
||||
const maxMemory = 32 << 20 // 32 MB
|
||||
r.ParseMultipartForm(maxMemory)
|
||||
}
|
||||
|
||||
for _, header := range s.conf.DebugHTTPHeaders {
|
||||
if value:= r.Header.Get(header); value != "" {
|
||||
log.Printf("%s: %s\n", header, value)
|
||||
}
|
||||
}
|
||||
|
||||
contentType := r.Header.Get("Content-Type")
|
||||
if ct := r.FormValue("ct"); ct != "" {
|
||||
contentType = ct
|
||||
|
||||
Reference in New Issue
Block a user