Upgrade net package from Go 1.21.4 to Go 1.26.2

Backport upstream Go standard library changes to TinyGo's net package.

Unmodified files (18) replaced directly from Go 1.26.2 source.
Modified files (22) merged via 3-way diff, preserving all TinyGo
netdev adaptations, TINYGO markers, and embedded-device constraints.

Notable upstream changes included:
- net/http: cookie handling improvements, fs enhancements,
  reverse proxy updates, chunked encoding fixes
- net/http: ServeMux routing and pattern matching updates
- net: IP parsing and MAC address handling improvements
- Various doc link syntax modernization (e.g. [Dial], [Buffers])

TinyGo-only files (netdev.go, tlssock.go) unchanged.
All TINYGO comment markers preserved.
This commit is contained in:
deadprogram
2026-04-13 17:36:35 +02:00
committed by Ron Evans
parent a3417d034f
commit 35e809e0e5
46 changed files with 1580 additions and 779 deletions
+20 -3
View File
@@ -1,4 +1,4 @@
// TINYGO: The following is copied from Go 1.21.4 official implementation.
// TINYGO: The following is copied from Go 1.26.2 official implementation.
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -38,8 +38,9 @@ func (a HardwareAddr) String() string {
// 0000.5e00.5301
// 0200.5e10.0000.0001
// 0000.0000.fe80.0000.0000.0000.0200.5e10.0000.0001
// 00005e005301
func ParseMAC(s string) (hw HardwareAddr, err error) {
if len(s) < 14 {
if len(s) < 12 {
goto error
}
@@ -79,7 +80,23 @@ func ParseMAC(s string) (hw HardwareAddr, err error) {
x += 5
}
} else {
goto error
if len(s)%2 != 0 {
goto error
}
n := len(s) / 2
if n != 6 && n != 8 && n != 20 {
goto error
}
hw = make(HardwareAddr, len(s)/2)
for x, i := 0, 0; i < n; i++ {
var ok bool
if hw[i], ok = xtoi2(s[x:x+2], 0); !ok {
goto error
}
x += 2
}
}
return hw, nil