mirror of
https://github.com/tinygo-org/net.git
synced 2026-07-26 08:18:39 +00:00
35e809e0e5
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.
33 lines
850 B
Go
33 lines
850 B
Go
// TINYGO: The following is copied and modified 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
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// HTTP client implementation. See RFC 7230 through 7235.
|
|
//
|
|
// This is the low-level Transport implementation of RoundTripper.
|
|
// The high-level interface is in client.go.
|
|
|
|
package http
|
|
|
|
import (
|
|
"io"
|
|
"sync/atomic"
|
|
)
|
|
|
|
type readTrackingBody struct {
|
|
io.ReadCloser
|
|
didRead bool // not atomic.Bool because only one goroutine (the user's) should be accessing
|
|
didClose atomic.Bool
|
|
}
|
|
|
|
type Transport struct{}
|
|
|
|
var DefaultTransport RoundTripper = &Transport{}
|
|
|
|
// roundTrip implements a RoundTripper over HTTP.
|
|
func (t *Transport) RoundTrip(req *Request) (*Response, error) {
|
|
return roundTrip(req)
|
|
}
|