From 0e0b1cddf2bd4cdb629922149f17a21762158612 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 22 Nov 2022 09:07:30 -0500 Subject: [PATCH] doc/go1.20: add hyperlinks, minor edits Add links to all significant documentation symbols. Fix or improve wording a few places. Change-Id: I53277125eb75a8223a7464136e99accdb46744b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/452757 Reviewed-by: Damien Neil Reviewed-by: Bryan Mills TryBot-Bypass: Russ Cox Run-TryBot: Russ Cox --- doc/go1.20.html | 109 +++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 62 deletions(-) diff --git a/doc/go1.20.html b/doc/go1.20.html index fa712696ff..730ef93330 100644 --- a/doc/go1.20.html +++ b/doc/go1.20.html @@ -332,7 +332,7 @@ func RequestHandler(w ResponseWriter, r *Request) {

New ReverseProxy Rewrite hook

-

+

The httputil.ReverseProxy forwarding proxy includes a new Rewrite hook function, superseding the previous Director hook. @@ -358,7 +358,7 @@ func RequestHandler(w ResponseWriter, r *Request) { also sets the Host header of the outbound request.

-

+

The ProxyRequest.SetXForwarded method sets the X-Forwarded-For, X-Forwarded-Host, @@ -380,6 +380,11 @@ proxyHandler := &httputil.ReverseProxy{ } +

+ ReverseProxy no longer adds a User-Agent header + to forwarded requests when the incoming request does not have one. +

+

Minor changes to the library

@@ -396,14 +401,13 @@ proxyHandler := &httputil.ReverseProxy{

archive/tar

- When the GODEBUG=tarinsecurepath=0 environment variable - is set, (*Reader).Next will return the error - ErrInsecurePath when opening an archive which contains - file names that are absolute, refer to a location outside the current - directory, contain invalid characters, or (on Windows) are reserved - names such as NUL. Programs that perform their own - name sanitization can ignore this error. This behavior will be made - the default in a future version of Go. + When the GODEBUG=tarinsecurepath=0 environment variable is set, + Reader.Next method + will now return the error ErrInsecurePath + for an entry with a file name that is an absolute path, + refers to a location outside the current directory, contains invalid + characters, or (on Windows) is a reserved name such as NUL. + A future version of Go may disable insecure paths by default.

@@ -411,14 +415,13 @@ proxyHandler := &httputil.ReverseProxy{
archive/zip

- When the GODEBUG=zipinsecurepath=0 environment variable - is set, NewReader will return the error - ErrInsecurePath when opening an archive which contains - file names that are absolute, refer to a location outside the current - irectory, contain invalid characters, or (on Windows) are reserved - names such as NUL. Programs that perform their own - name sanitization can ignore this error. This behavior will be made - the default in a future version of Go. + When the GODEBUG=zipinsecurepath=0 environment variable is set, + NewReader will now return the error + ErrInsecurePath + when opening an archive which contains any file name that is an absolute path, + refers to a location outside the current directory, contains invalid + characters, or (on Windows) is a reserved names such as NUL. + A future version of Go may disable insecure paths by default.

Reading from a directory file that contains file data will now return an error. @@ -557,7 +560,7 @@ proxyHandler := &httputil.ReverseProxy{

errors

- The new Join function returns an error wrapping a list of errors. + The new Join function returns an error wrapping a list of errors.

@@ -565,8 +568,8 @@ proxyHandler := &httputil.ReverseProxy{
fmt

- The Errorf function supports multiple occurrances of - the %w format verb. + The Errorf function supports multiple occurrences of + the %w format verb, returning an error that unwraps to the list of all arguments to %w.

TODO: https://go.dev/issue/51668: add FormatString(State) string @@ -646,7 +649,7 @@ proxyHandler := &httputil.ReverseProxy{

mime

- The ParseMediaType function now allows duplicate parameter names, + The ParseMediaType function now allows duplicate parameter names, so long as the values of the names are the same.

@@ -655,7 +658,7 @@ proxyHandler := &httputil.ReverseProxy{
mime/multipart

- Methods of the Reader type now wrap errors + Methods of the Reader type now wrap errors returned by the underlying io.Reader.

@@ -664,7 +667,8 @@ proxyHandler := &httputil.ReverseProxy{
net

- The LookupCNAME function now consistently returns the contents + The LookupCNAME + function now consistently returns the contents of a CNAME record when one exists. Previously on Unix systems and when using the pure Go resolver, LookupCNAME would return an error if a CNAME record referred to a name that with no A, @@ -675,15 +679,15 @@ proxyHandler := &httputil.ReverseProxy{

- Interface.Flags now includes the new flag FlagRunning, + Interface.Flags now includes the new flag FlagRunning, indicating an operationally active interface. An interface which is administratively configured but not active (for example, because the network cable is not connected) will have FlagUp set but not FlagRunning.

- The new Dialer.ControlContext field contains a callback function - similar to the existing Dialer.Control hook, that additionally + The new Dialer.ControlContext field contains a callback function + similar to the existing Dialer.Control hook, that additionally accepts the dial context as a parameter. Control is ignored when ControlContext is not nil.

@@ -707,28 +711,28 @@ proxyHandler := &httputil.ReverseProxy{
net/http

- The new ResponseController type provides access to extended per-request - functionality not handled by the ResponseWriter interface. + The new ResponseController type provides access to extended per-request + functionality not handled by the ResponseWriter interface.

- The new ResponseController.SetReadDeadline and - ResponseController.SetWriteDeadline methods permit setting + The new ResponseController.SetReadDeadline and + ResponseController.SetWriteDeadline methods permit setting per-request read and write deadlines.

- The ResponseWriter.WriteHeader function now supports sending + The ResponseWriter.WriteHeader function now supports sending 1xx status codes.

- The new Server.DisableGeneralOptionsHandler configuration setting + The new Server.DisableGeneralOptionsHandler configuration setting allows disabling the default OPTIONS * handler.

- The new Transport.OnProxyConnectResponse hook is called + The new Transport.OnProxyConnectResponse hook is called when a Transport receives an HTTP response from a proxy for a CONNECT request.

@@ -740,7 +744,8 @@ proxyHandler := &httputil.ReverseProxy{

HTTP/2 stream errors returned by net/http functions may be converted - to a "golang.org/x/net/http2".StreamError using errors.As. + to a golang.org/x/net/http2.StreamError using + errors.As.

@@ -752,28 +757,6 @@ proxyHandler := &httputil.ReverseProxy{

-
net/http/httputil
-
-

- The new ReverseProxy hook supersedes the existing Rewrite hook. -

- -

- ReverseProxy now adds - X-Forwarded-Proto and X-Forwarded-Host headers - to forwarded requests. - These headers are added to all requests forwarded by a Director hook, - and to requests forwarded by a Rewrite hook which calls the - ProxyRequest.SetXForwarded function. -

- -

- ReverseProxy no longer adds a User-Agent header - to forwarded requests when the incoming request does not have one. -

-
-
-
net/netip

@@ -801,7 +784,9 @@ proxyHandler := &httputil.ReverseProxy{

os/exec

- The new Cmd fields Cancel and WaitDelay + The new Cmd fields + Cancel and + WaitDelay specify the behavior of the Cmd when its associated Context is canceled or its process exits with I/O pipes still held open by a child process. @@ -815,7 +800,7 @@ proxyHandler := &httputil.ReverseProxy{ TODO: https://go.dev/cl/363814: path/filepath, io/fs: add SkipAll; modified api/next/47209.txt

- The new IsLocal function reports whether a path is + The new IsLocal function reports whether a path is lexically local to a directory. For example, if IsLocal(p) is true, then Open(p) will refer to a file that is lexically @@ -899,9 +884,9 @@ proxyHandler := &httputil.ReverseProxy{

sync

- The new methods Map.Swap, - Map.CompareAndSwap, and - Map.CompareAndDelete + The new Map methods Swap, + CompareAndSwap, and + CompareAndDelete allow existing map entries to be updated atomically.