From 2f0a306d283c21b98089706878190c34bd591b9a Mon Sep 17 00:00:00 2001
From: Brad Fitzpatrick
Date: Wed, 23 Nov 2016 03:46:58 +0000
Subject: [PATCH] doc: add net/http section to go1.8.html
TBR=See https://golang.org/cl/33244 and review there.
Updates #17929
Change-Id: I752ec7a6d086f370feaf3cf282708620e891079b
Reviewed-on: https://go-review.googlesource.com/33478
Reviewed-by: Brad Fitzpatrick
---
doc/go1.8.html | 123 +++++++++++++++++++++++++++++++++++++++++++++++--
doc/go1.8.txt | 55 +++++++++++-----------
2 files changed, 147 insertions(+), 31 deletions(-)
diff --git a/doc/go1.8.html b/doc/go1.8.html
index e153d1bc6c..90878a0a31 100644
--- a/doc/go1.8.html
+++ b/doc/go1.8.html
@@ -314,7 +314,15 @@ now implements the new
Pusher
interface.
-HTTP Server Graceful Shutdown
+HTTP Server Graceful Shutdown
+
+
+ The HTTP Server now has support for graceful shutdown using the new
+ Server.Shutdown
+ method. The related and more abrupt
+ Server.Close
+ is also new.
+
Minor changes to the library
@@ -556,9 +564,118 @@ pkg debug/pe, type StringTable []uint8
- net/http
-
+
Server changes:
+
+ - The server now supports graceful shutdown support, mentioned above.
+
+ -
+ The
Server
now
+ has new configuration options
+ ReadHeaderTimeout
and IdleTimeout
.
+ The previously ill-defined WriteTimeout
is now
+ documented.
+
+
+ -
+
FileServer
+ and
+ ServeContent
+ now support HTTP If-Match
conditional requests,
+ in addition to the previous If-None-Match
+ support.
+
+
+ -
+ The server now logs bad requests.
+
+
+
- TODO
-
+ There are several additions to what a server's Handler
can do:
+
+
+
+ -
+ The
Context
+ returned
+ by Request.Context
+ is canceled if the underlying net.Conn
+ closes. For instance, if the user closes their browser in the
+ middle of a slow request, the Handler
can now
+ detect that the user is gone. This complements the
+ existing CloseNotifier
+ support.
+
+
+ - There is now a second way to serve trailers
+ for when the trailer name is not known before the headers are
+ written (via a call to
+ to
ResponseWriter.WriteHeader
). The old way
+ continues to work, but when the trailer is only known after the
+ header has been written, see the
+ new TrailerPrefix
.
+
+ -
+ A
Handler
now has a supported mechanism to abort a
+ response: panicking with
+ ErrAbortHandler
.
+
+
+ -
+ There is now a supported mechanism to test whether a
+
ResponseWriter
has been hijacked: Write
zero bytes to it.
+ While this previously returned
+ ErrHijacked
, now
+ it also does so without spamming the server's error log.
+
+
+
+
+ Client & Transport changes:
+
+ -
+ The
Client
now copies request headers on redirect.
+
+
+ -
+ The
Transport
now supports international domain names.
+
+
+ -
+ The
Client
now supports 307 and 308 redirects.
+ If the redirect involves re-sending the request body,
+ the request must have the new
+ Request.GetBody
+ field defined.
+ NewRequest
+ sets Request.GetBody
automatically for common
+ body types.
+
+
+ -
+ The
Transport
now rejects requests for URLs with
+ ports containing non-digit characters.
+
+
+ -
+ The
Transport
will now retry non-idempotent
+ requests if no bytes were written before a network failure.
+
+
+ -
+ The
+ new
Transport.ProxyConnectHeader
+ allows configuration of header values to send to a proxy
+ during a CONNECT
request.
+
+
+ -
+ The
DefaultTransport.Dialer
+ now enables DualStack
("Happy Eyeballs") support,
+ to use IPv4 as a backup if it looks like IPv6 might be
+ failing.
+
+
diff --git a/doc/go1.8.txt b/doc/go1.8.txt
index d6f615ab7a..0c9f6ce249 100644
--- a/doc/go1.8.txt
+++ b/doc/go1.8.txt
@@ -172,34 +172,6 @@ net/http/httputil: make ReverseProxy send nil Body requests when possible (CL 28
net/http/httputil: remove custom hop-by-hop headers from response in ReverseProxy (CL 28810)
net/http/httputil: remove proxied headers mentioned in connection-tokens (CL 27970)
-net/http, net/http/httptest: make http2's TrailerPrefix work for http1 (CL 32479)
-net/http: add ErrAbortHandler, make Server quiet if used as panic value (CL 33099)
-net/http: add NoBody, don't return nil from NewRequest on zero bodies (CL 31726)
-net/http: add Request.GetBody func for 307/308 redirects (CL 31733)
-net/http: add Server.Close & Server.Shutdown for forced & graceful shutdown (CL 32329)
-net/http: add Server.ReadHeaderTimeout, IdleTimeout, document WriteTimeout (CL 32024)
-net/http: add Transport.ProxyConnectHeader to control headers to proxies (CL 32481)
-net/http: allow Handlers to test Hijacked conn without spamming error log (CL 30812)
-net/http: don't sniff Request.Body on 100-continue requests in Transport (CL 30151)
-net/http: handle 3xx redirects properly (CL 29852)
-net/http: make Client copy headers on redirect (CL 28930)
-net/http: make DefaultTransport's Dialer enable DualStack ("Happy Eyeballs") (CL 28077)
-net/http: make NewRequest set empty Body nil, don't peek Read Body in Transport (CL 31445)
-net/http: make Redirect escape non-ASCII in Location header (CL 31732)
-net/http: make Server Handler's Request.Context be done on conn errors (CL 31173)
-net/http: make Server log on bad requests from clients (CL 27950)
-net/http: make Transport reject URLs with bogus ports with non-digits (CL 32482)
-net/http: make Transport retry non-idempotent requests if no bytes written (CL 27117)
-net/http: make Transport support international domain names (CL 29072)
-net/http: omit Content-Length in Response.Write for 1xx or 204 status (CL 28351)
-net/http: returned typed error on Transport proxy dial (CL 30750)
-net/http: send Content-Range if no byte range overlaps (CL 24212)
-net/http: skip test needing good DNS in short mode, except on builders (CL 28782)
-net/http: support If-Match in ServeContent (CL 32014)
-net/http: support multiple identical Content-Length headers (CL 31252)
-net/http: update bundled http2 for ErrAbortHandler support, document it more (CL 33103)
-net/http: update bundled http2, add h2 Transport.IdleConnTimeout tests (CL 30078)
-
net: add (*UnixListener).SetUnlinkOnClose (CL 32099)
net: add Buffers type, do writev on unix (CL 29951)
net: implement Buffers on windows (CL 32371)
@@ -458,7 +430,34 @@ lib/time: update tzdata to 2016i (CL 33029)
math/rand: add Rand.Uint64 (CL 27253)
mime/quotedprintable: accept = not followed by 2 hex digits as literal equals (CL 32174)
mime/quotedprintable: accept trailing soft line-break at the end of message (CL 27530)
+net/http, net/http/httptest: make http2's TrailerPrefix work for http1 (CL 32479)
+net/http: add ErrAbortHandler, make Server quiet if used as panic value (CL 33099)
+net/http: add NoBody, don't return nil from NewRequest on zero bodies (CL 31726)
+net/http: add Request.GetBody func for 307/308 redirects (CL 31733)
+net/http: add Server.Close & Server.Shutdown for forced & graceful shutdown (CL 32329)
+net/http: add Server.ReadHeaderTimeout, IdleTimeout, document WriteTimeout (CL 32024)
+net/http: add Transport.ProxyConnectHeader to control headers to proxies (CL 32481)
net/http: add an interface for HTTP/2 server push (CL 32012)
+net/http: allow Handlers to test Hijacked conn without spamming error log (CL 30812)
+net/http: don't sniff Request.Body on 100-continue requests in Transport (CL 30151)
+net/http: handle 3xx redirects properly (CL 29852)
+net/http: make Client copy headers on redirect (CL 28930)
+net/http: make DefaultTransport's Dialer enable DualStack ("Happy Eyeballs") (CL 28077)
+net/http: make NewRequest set empty Body nil, don't peek Read Body in Transport (CL 31445)
+net/http: make Redirect escape non-ASCII in Location header (CL 31732)
+net/http: make Server Handler's Request.Context be done on conn errors (CL 31173)
+net/http: make Server log on bad requests from clients (CL 27950)
+net/http: make Transport reject URLs with bogus ports with non-digits (CL 32482)
+net/http: make Transport retry non-idempotent requests if no bytes written (CL 27117)
+net/http: make Transport support international domain names (CL 29072)
+net/http: omit Content-Length in Response.Write for 1xx or 204 status (CL 28351)
+net/http: returned typed error on Transport proxy dial (CL 30750)
+net/http: send Content-Range if no byte range overlaps (CL 24212)
+net/http: skip test needing good DNS in short mode, except on builders (CL 28782)
+net/http: support If-Match in ServeContent (CL 32014)
+net/http: support multiple identical Content-Length headers (CL 31252)
+net/http: update bundled http2 for ErrAbortHandler support, document it more (CL 33103)
+net/http: update bundled http2, add h2 Transport.IdleConnTimeout tests (CL 30078)
net/mail: allow empty quoted string name in address again (CL 32176)
net/mail: expose ParseDate, for use parsing Resent-Date headers (CL 31581)
net/smtp: make Client.Auth trim final space if Auth.Start toServer is empty (CL 33143)
--
2.48.1