mirror of
https://github.com/go-i2p/go-meta-listener.git
synced 2025-07-04 06:35:27 -04:00
Add Host and X-Forwarded-X headers if there's an HTTP connection involved
This commit is contained in:
@ -2,6 +2,7 @@ package mirror
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
@ -18,8 +19,10 @@ func AddHeaders(conn net.Conn, headers map[string]string) net.Conn {
|
||||
if err != nil {
|
||||
return conn
|
||||
}
|
||||
log.Println("Adding headers to connection:", req.Method, req.URL)
|
||||
for key, value := range headers {
|
||||
req.Header.Add(key, value)
|
||||
log.Println("Added header:", key, value)
|
||||
}
|
||||
// write the request back to the connection
|
||||
if err := req.Write(conn); err != nil {
|
||||
|
Reference in New Issue
Block a user