fix Mux bug not matching paths correctly; httpraw HTTP V1 naming applied

This commit is contained in:
Patricio Whittingslow
2026-07-30 16:40:44 -03:00
parent aa259d1efd
commit 9ff97f1808
18 changed files with 410 additions and 174 deletions
@@ -274,7 +274,7 @@ func handleConnNet(conn net.Conn) error {
defer conn.Close()
conn.SetDeadline(time.Now().Add(10 * time.Second))
var hdr httpraw.Header
var hdr httpraw.HeaderV1
needMore := true
for needMore {
_, err := hdr.ReadFromLimited(conn, 1024)
@@ -291,7 +291,7 @@ func handleConnNet(conn net.Conn) error {
uri := string(hdr.RequestTarget())
fmt.Printf("< %s %s\n", method, uri)
var resp httpraw.Header
var resp httpraw.HeaderV1
resp.SetProtocol("HTTP/1.1")
resp.SetStatus("200", "OK")
resp.Set("Content-Type", "text/html")
@@ -368,7 +368,7 @@ func mockClient(stack *xnet.StackAsync, port uint16, subnet netip.Prefix) {
panic("mock client deadline exceeded to establish")
}
var hdr httpraw.Header
var hdr httpraw.HeaderV1
hdr.SetMethod("GET")
hdr.SetRequestTarget("/")
hdr.SetProtocol("HTTP/1.1")
+1 -1
View File
@@ -25,7 +25,7 @@ func run() error {
flag.IntVar(&port, "lport", 13337, "Local port over which to hit server")
flag.Parse()
// Prepare GET request.
var hdr httpraw.Header
var hdr httpraw.HeaderV1
hdr.SetMethod("GET")
hdr.SetRequestTarget("/")
hdr.SetProtocol("HTTP/1.1")
+2 -2
View File
@@ -267,7 +267,7 @@ func handleConnection(conn *tcp.Conn) error {
conn.SetDeadline(time.Now().Add(10 * time.Second))
// Read HTTP request.
var hdr httpraw.Header
var hdr httpraw.HeaderV1
var needMore bool = true
for needMore {
_, err := hdr.ReadFromLimited(conn, 1024)
@@ -288,7 +288,7 @@ func handleConnection(conn *tcp.Conn) error {
// Build response body.
// Build HTTP response.
var resp httpraw.Header
var resp httpraw.HeaderV1
resp.SetProtocol("HTTP/1.1")
resp.SetStatus("200", "OK")
resp.Set("Content-Type", "text/html")
+1 -1
View File
@@ -305,7 +305,7 @@ func run() (err error) {
})
timeHTTPCreate := timer("create HTTP GET request")
var hdr httpraw.Header
var hdr httpraw.HeaderV1
hdr.SetMethod("GET")
hdr.SetRequestTarget("/")
hdr.SetProtocol("HTTP/1.1")