massive documentation push and code reordering in files

This commit is contained in:
Patricio Whittingslow
2026-07-26 02:59:13 -03:00
parent 2ac4380442
commit 3b3fb1328a
18 changed files with 886 additions and 770 deletions
@@ -288,7 +288,7 @@ func handleConnNet(conn net.Conn) error {
}
}
method := string(hdr.Method())
uri := string(hdr.RequestURI())
uri := string(hdr.RequestTarget())
fmt.Printf("< %s %s\n", method, uri)
var resp httpraw.Header
@@ -370,7 +370,7 @@ func mockClient(stack *xnet.StackAsync, port uint16, subnet netip.Prefix) {
var hdr httpraw.Header
hdr.SetMethod("GET")
hdr.SetRequestURI("/")
hdr.SetRequestTarget("/")
hdr.SetProtocol("HTTP/1.1")
hdr.Set("Host", string(ipv4.AppendFormatAddr(nil, stack.Addr4())))
hdr.Set("User-Agent", "lneto-mock")
+2 -2
View File
@@ -97,8 +97,8 @@ func homepage(exch *httphi.Exchange) {
n += len(strconv.AppendUint(page[n:n], visits.Add(1), 10))
n += copy(page[n:], htmlTail)
exch.SetHeader("Content-Type", "text/html")
exch.SetHeaderInt("Content-Length", int64(n), 10)
exch.StageHeader("Content-Type", "text/html")
exch.StageHeaderInt("Content-Length", int64(n), 10)
exch.WriteHeader(int(httphi.StatusOK))
exch.Write(page[:n])
}
+1 -1
View File
@@ -27,7 +27,7 @@ func run() error {
// Prepare GET request.
var hdr httpraw.Header
hdr.SetMethod("GET")
hdr.SetRequestURI("/")
hdr.SetRequestTarget("/")
hdr.SetProtocol("HTTP/1.1")
req, err := hdr.AppendRequest(nil)
if err != nil {
+1 -1
View File
@@ -282,7 +282,7 @@ func handleConnection(conn *tcp.Conn) error {
}
method := string(hdr.Method())
uri := string(hdr.RequestURI())
uri := string(hdr.RequestTarget())
fmt.Printf("< %s %s\n", method, uri)
// Build response body.
+1 -1
View File
@@ -307,7 +307,7 @@ func run() (err error) {
timeHTTPCreate := timer("create HTTP GET request")
var hdr httpraw.Header
hdr.SetMethod("GET")
hdr.SetRequestURI("/")
hdr.SetRequestTarget("/")
hdr.SetProtocol("HTTP/1.1")
hdr.Set("Host", flagHostToResolve)
hdr.Set("User-Agent", "lneto")