aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-03-01 23:21:55 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2016-03-02 00:13:47 +0000
commit5fea2ccc77eb50a9704fa04b7c61755fe34e1d95 (patch)
tree00137f90183ae2a01ca42249e04e9e4dabdf6249 /src/net/http
parent8b4deb448e587802f67930b765c9598fc8cd36e5 (diff)
downloadgo-5fea2ccc77eb50a9704fa04b7c61755fe34e1d95.tar.xz
all: single space after period.
The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/cgi/host.go2
-rw-r--r--src/net/http/client.go2
-rw-r--r--src/net/http/clientserver_test.go2
-rw-r--r--src/net/http/filetransport.go2
-rw-r--r--src/net/http/fs.go10
-rw-r--r--src/net/http/h2_bundle.go12
-rw-r--r--src/net/http/header.go8
-rw-r--r--src/net/http/httptest/server.go4
-rw-r--r--src/net/http/httputil/dump.go4
-rw-r--r--src/net/http/httputil/persist.go2
-rw-r--r--src/net/http/httputil/reverseproxy.go4
-rw-r--r--src/net/http/pprof/pprof.go6
-rw-r--r--src/net/http/request.go8
-rw-r--r--src/net/http/requestwrite_test.go2
-rw-r--r--src/net/http/response.go12
-rw-r--r--src/net/http/serve_test.go16
-rw-r--r--src/net/http/server.go44
-rw-r--r--src/net/http/sniff.go4
-rw-r--r--src/net/http/transfer.go10
-rw-r--r--src/net/http/transport.go12
-rw-r--r--src/net/http/transport_test.go20
21 files changed, 93 insertions, 93 deletions
diff --git a/src/net/http/cgi/host.go b/src/net/http/cgi/host.go
index 9b4d875418..b2657b13a8 100644
--- a/src/net/http/cgi/host.go
+++ b/src/net/http/cgi/host.go
@@ -10,7 +10,7 @@
//
// Note that using CGI means starting a new process to handle each
// request, which is typically less efficient than using a
-// long-running server. This package is intended primarily for
+// long-running server. This package is intended primarily for
// compatibility with existing systems.
package cgi
diff --git a/src/net/http/client.go b/src/net/http/client.go
index 3106d229da..68676a5dc9 100644
--- a/src/net/http/client.go
+++ b/src/net/http/client.go
@@ -237,7 +237,7 @@ func send(ireq *Request, rt RoundTripper, deadline time.Time) (*Response, error)
}
// Most the callers of send (Get, Post, et al) don't need
- // Headers, leaving it uninitialized. We guarantee to the
+ // Headers, leaving it uninitialized. We guarantee to the
// Transport that this has been initialized, though.
if req.Header == nil {
forkReq()
diff --git a/src/net/http/clientserver_test.go b/src/net/http/clientserver_test.go
index fbaa805712..171060b541 100644
--- a/src/net/http/clientserver_test.go
+++ b/src/net/http/clientserver_test.go
@@ -356,7 +356,7 @@ func TestH12_HandlerWritesTooLittle(t *testing.T) {
}
// Tests that the HTTP/1 and HTTP/2 servers prevent handlers from
-// writing more than they declared. This test does not test whether
+// writing more than they declared. This test does not test whether
// the transport deals with too much data, though, since the server
// doesn't make it possible to send bogus data. For those tests, see
// transport_test.go (for HTTP/1) or x/net/http2/transport_test.go
diff --git a/src/net/http/filetransport.go b/src/net/http/filetransport.go
index 821787e0c4..32126d7ec0 100644
--- a/src/net/http/filetransport.go
+++ b/src/net/http/filetransport.go
@@ -33,7 +33,7 @@ func NewFileTransport(fs FileSystem) RoundTripper {
func (t fileTransport) RoundTrip(req *Request) (resp *Response, err error) {
// We start ServeHTTP in a goroutine, which may take a long
- // time if the file is large. The newPopulateResponseWriter
+ // time if the file is large. The newPopulateResponseWriter
// call returns a channel which either ServeHTTP or finish()
// sends our *Response on, once the *Response itself has been
// populated (even if the body itself is still being
diff --git a/src/net/http/fs.go b/src/net/http/fs.go
index 520a5477a7..7e672a0910 100644
--- a/src/net/http/fs.go
+++ b/src/net/http/fs.go
@@ -96,7 +96,7 @@ func dirList(w ResponseWriter, f File) {
}
// ServeContent replies to the request using the content in the
-// provided ReadSeeker. The main benefit of ServeContent over io.Copy
+// provided ReadSeeker. The main benefit of ServeContent over io.Copy
// is that it handles Range requests properly, sets the MIME type, and
// handles If-Modified-Since requests.
//
@@ -108,7 +108,7 @@ func dirList(w ResponseWriter, f File) {
// never sent in the response.
//
// If modtime is not the zero time or Unix epoch, ServeContent
-// includes it in a Last-Modified header in the response. If the
+// includes it in a Last-Modified header in the response. If the
// request includes an If-Modified-Since header, ServeContent uses
// modtime to decide whether the content needs to be sent at all.
//
@@ -196,7 +196,7 @@ func serveContent(w ResponseWriter, r *Request, name string, modtime time.Time,
// The total number of bytes in all the ranges
// is larger than the size of the file by
// itself, so this is probably an attack, or a
- // dumb client. Ignore the range request.
+ // dumb client. Ignore the range request.
ranges = nil
}
switch {
@@ -291,7 +291,7 @@ func checkLastModified(w ResponseWriter, r *Request, modtime time.Time) bool {
// checkETag implements If-None-Match and If-Range checks.
//
// The ETag or modtime must have been previously set in the
-// ResponseWriter's headers. The modtime is only compared at second
+// ResponseWriter's headers. The modtime is only compared at second
// granularity and may be the zero value to mean unknown.
//
// The return value is the effective request "Range" header to use and
@@ -336,7 +336,7 @@ func checkETag(w ResponseWriter, r *Request, modtime time.Time) (rangeReq string
}
// TODO(bradfitz): deal with comma-separated or multiple-valued
- // list of If-None-match values. For now just handle the common
+ // list of If-None-match values. For now just handle the common
// case of a single item.
if inm == etag || inm == "*" {
h := w.Header()
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index f778acb2b5..1e9088c9c3 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -300,7 +300,7 @@ func http2registerHTTPSProtocol(t *Transport, rt RoundTripper) (err error) {
}
// noDialClientConnPool is an implementation of http2.ClientConnPool
-// which never dials. We let the HTTP/1.1 client dial and use its TLS
+// which never dials. We let the HTTP/1.1 client dial and use its TLS
// connection instead.
type http2noDialClientConnPool struct{ *http2clientConnPool }
@@ -1421,7 +1421,7 @@ type http2PriorityParam struct {
Exclusive bool
// Weight is the stream's zero-indexed weight. It should be
- // set together with StreamDep, or neither should be set. Per
+ // set together with StreamDep, or neither should be set. Per
// the spec, "Add one to the value to obtain a weight between
// 1 and 256."
Weight uint8
@@ -2335,7 +2335,7 @@ type http2connectionStater interface {
ConnectionState() tls.ConnectionState
}
-// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
+// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
// io.Pipe except there are no PipeReader/PipeWriter halves, and the
// underlying buffer is an interface. (io.Pipe is always unbuffered)
type http2pipe struct {
@@ -4211,8 +4211,8 @@ func (b *http2requestBody) Read(p []byte) (n int, err error) {
return
}
-// responseWriter is the http.ResponseWriter implementation. It's
-// intentionally small (1 pointer wide) to minimize garbage. The
+// responseWriter is the http.ResponseWriter implementation. It's
+// intentionally small (1 pointer wide) to minimize garbage. The
// responseWriterState pointer inside is zeroed at the end of a
// request (in handlerDone) and calls on the responseWriter thereafter
// simply crash (caller's mistake), but the much larger responseWriterState
@@ -4386,7 +4386,7 @@ const http2TrailerPrefix = "Trailer:"
// says you SHOULD (but not must) predeclare any trailers in the
// header, the official ResponseWriter rules said trailers in Go must
// be predeclared, and then we reuse the same ResponseWriter.Header()
-// map to mean both Headers and Trailers. When it's time to write the
+// map to mean both Headers and Trailers. When it's time to write the
// Trailers, we pick out the fields of Headers that were declared as
// trailers. That worked for a while, until we found the first major
// user of Trailers in the wild: gRPC (using them only over http2),
diff --git a/src/net/http/header.go b/src/net/http/header.go
index 57f311fedc..6343165a84 100644
--- a/src/net/http/header.go
+++ b/src/net/http/header.go
@@ -25,7 +25,7 @@ func (h Header) Add(key, value string) {
}
// Set sets the header entries associated with key to
-// the single element value. It replaces any existing
+// the single element value. It replaces any existing
// values associated with key.
func (h Header) Set(key, value string) {
textproto.MIMEHeader(h).Set(key, value)
@@ -164,9 +164,9 @@ func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error {
}
// CanonicalHeaderKey returns the canonical format of the
-// header key s. The canonicalization converts the first
+// header key s. The canonicalization converts the first
// letter and any letter following a hyphen to upper case;
-// the rest are converted to lowercase. For example, the
+// the rest are converted to lowercase. For example, the
// canonical key for "accept-encoding" is "Accept-Encoding".
// If s contains a space or invalid header field bytes, it is
// returned without modifications.
@@ -186,7 +186,7 @@ func hasToken(v, token string) bool {
for sp := 0; sp <= len(v)-len(token); sp++ {
// Check that first character is good.
// The token is ASCII, so checking only a single byte
- // is sufficient. We skip this potential starting
+ // is sufficient. We skip this potential starting
// position if both the first byte and its potential
// ASCII uppercase equivalent (b|0x20) don't match.
// False positives ('^' => '~') are caught by EqualFold.
diff --git a/src/net/http/httptest/server.go b/src/net/http/httptest/server.go
index 7e52adb607..8655426eaf 100644
--- a/src/net/http/httptest/server.go
+++ b/src/net/http/httptest/server.go
@@ -158,7 +158,7 @@ func (s *Server) Close() {
// previously-flaky tests) in the case of
// socket-late-binding races from the http Client
// dialing this server and then getting an idle
- // connection before the dial completed. There is thus
+ // connection before the dial completed. There is thus
// a connected connection in StateNew with no
// associated Request. We only close StateIdle and
// StateNew because they're not doing anything. It's
@@ -297,7 +297,7 @@ func (s *Server) closeConn(c net.Conn) { s.closeConnChan(c, nil) }
func (s *Server) closeConnChan(c net.Conn, done chan<- bool) {
if runtime.GOOS == "plan9" {
// Go's Plan 9 net package isn't great at unblocking reads when
- // their underlying TCP connections are closed. Don't trust
+ // their underlying TCP connections are closed. Don't trust
// that that the ConnState state machine will get to
// StateClosed. Instead, just go there directly. Plan 9 may leak
// resources if the syscall doesn't end up returning. Oh well.
diff --git a/src/net/http/httputil/dump.go b/src/net/http/httputil/dump.go
index 245eed0b21..3af5395898 100644
--- a/src/net/http/httputil/dump.go
+++ b/src/net/http/httputil/dump.go
@@ -128,7 +128,7 @@ func DumpRequestOut(req *http.Request, body bool) ([]byte, error) {
// If we used a dummy body above, remove it now.
// TODO: if the req.ContentLength is large, we allocate memory
- // unnecessarily just to slice it off here. But this is just
+ // unnecessarily just to slice it off here. But this is just
// a debug function, so this is acceptable for now. We could
// discard the body earlier if this matters.
if dummyBody {
@@ -269,7 +269,7 @@ func DumpRequest(req *http.Request, body bool) (dump []byte, err error) {
var errNoBody = errors.New("sentinel error value")
// failureToReadBody is a io.ReadCloser that just returns errNoBody on
-// Read. It's swapped in when we don't actually want to consume
+// Read. It's swapped in when we don't actually want to consume
// the body, but need a non-nil one, and want to distinguish the
// error from reading the dummy body.
type failureToReadBody struct{}
diff --git a/src/net/http/httputil/persist.go b/src/net/http/httputil/persist.go
index 987bcc96ba..4cb110b716 100644
--- a/src/net/http/httputil/persist.go
+++ b/src/net/http/httputil/persist.go
@@ -239,7 +239,7 @@ type ClientConn struct {
writeReq func(*http.Request, io.Writer) error
}
-// NewClientConn returns a new ClientConn reading and writing c. If r is not
+// NewClientConn returns a new ClientConn reading and writing c. If r is not
// nil, it is the buffer to use when reading c.
//
// ClientConn is low-level and old. Applications should use Client or
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
index 54411caeca..26a668b6df 100644
--- a/src/net/http/httputil/reverseproxy.go
+++ b/src/net/http/httputil/reverseproxy.go
@@ -180,9 +180,9 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
outreq.ProtoMinor = 1
outreq.Close = false
- // Remove hop-by-hop headers to the backend. Especially
+ // Remove hop-by-hop headers to the backend. Especially
// important is "Connection" because we want a persistent
- // connection, regardless of what the client sent to us. This
+ // connection, regardless of what the client sent to us. This
// is modifying the same underlying map from req (shallow
// copied above) so we only copy it if necessary.
copiedHeaders := false
diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go
index 3400dbbdc6..2357d8ed1e 100644
--- a/src/net/http/pprof/pprof.go
+++ b/src/net/http/pprof/pprof.go
@@ -15,7 +15,7 @@
// import _ "net/http/pprof"
//
// If your application is not already running an http server, you
-// need to start one. Add "net/http" and "log" to your imports and
+// need to start one. Add "net/http" and "log" to your imports and
// the following code to your main function:
//
// go func() {
@@ -146,11 +146,11 @@ func Symbol(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
// We have to read the whole POST body before
- // writing any output. Buffer the output here.
+ // writing any output. Buffer the output here.
var buf bytes.Buffer
// We don't know how many symbols we have, but we
- // do have symbol information. Pprof only cares whether
+ // do have symbol information. Pprof only cares whether
// this number is 0 (no symbols available) or > 0.
fmt.Fprintf(&buf, "num_symbols: 1\n")
diff --git a/src/net/http/request.go b/src/net/http/request.go
index 4037f40a3e..76fb8fe6d1 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -279,8 +279,8 @@ func (r *Request) Cookie(name string) (*Cookie, error) {
return nil, ErrNoCookie
}
-// AddCookie adds a cookie to the request. Per RFC 6265 section 5.4,
-// AddCookie does not attach more than one Cookie header field. That
+// AddCookie adds a cookie to the request. Per RFC 6265 section 5.4,
+// AddCookie does not attach more than one Cookie header field. That
// means all cookies, if any, are written into the same line,
// separated by semicolon.
func (r *Request) AddCookie(c *Cookie) {
@@ -375,7 +375,7 @@ func (r *Request) Write(w io.Writer) error {
}
// WriteProxy is like Write but writes the request in the form
-// expected by an HTTP proxy. In particular, WriteProxy writes the
+// expected by an HTTP proxy. In particular, WriteProxy writes the
// initial Request-URI line of the request with an absolute URI, per
// section 5.1.2 of RFC 2616, including the scheme and host.
// In either case, WriteProxy also writes a Host header, using
@@ -776,7 +776,7 @@ func readRequest(b *bufio.Reader, deleteHostHeader bool) (req *Request, err erro
// and
// GET http://www.google.com/index.html HTTP/1.1
// Host: doesntmatter
- // the same. In the second case, any Host line is ignored.
+ // the same. In the second case, any Host line is ignored.
req.Host = req.URL.Host
if req.Host == "" {
req.Host = req.Header.get("Host")
diff --git a/src/net/http/requestwrite_test.go b/src/net/http/requestwrite_test.go
index 671cca91a6..2545f6f4c2 100644
--- a/src/net/http/requestwrite_test.go
+++ b/src/net/http/requestwrite_test.go
@@ -604,7 +604,7 @@ func TestRequestWriteError(t *testing.T) {
failAfter, writeCount := 0, 0
errFail := errors.New("fake write failure")
- // w is the buffered io.Writer to write the request to. It
+ // w is the buffered io.Writer to write the request to. It
// fails exactly once on its Nth Write call, as controlled by
// failAfter. It also tracks the number of calls in
// writeCount.
diff --git a/src/net/http/response.go b/src/net/http/response.go
index c424f61cd0..a596d1d342 100644
--- a/src/net/http/response.go
+++ b/src/net/http/response.go
@@ -33,7 +33,7 @@ type Response struct {
ProtoMajor int // e.g. 1
ProtoMinor int // e.g. 0
- // Header maps header keys to values. If the response had multiple
+ // Header maps header keys to values. If the response had multiple
// headers with the same key, they may be concatenated, with comma
// delimiters. (Section 4.2 of RFC 2616 requires that multiple headers
// be semantically equivalent to a comma-delimited sequence.) Values
@@ -57,8 +57,8 @@ type Response struct {
// with a "chunked" Transfer-Encoding.
Body io.ReadCloser
- // ContentLength records the length of the associated content. The
- // value -1 indicates that the length is unknown. Unless Request.Method
+ // ContentLength records the length of the associated content. The
+ // value -1 indicates that the length is unknown. Unless Request.Method
// is "HEAD", values >= 0 indicate that the given number of bytes may
// be read from Body.
ContentLength int64
@@ -68,7 +68,7 @@ type Response struct {
TransferEncoding []string
// Close records whether the header directed that the connection be
- // closed after reading Body. The value is advice for clients: neither
+ // closed after reading Body. The value is advice for clients: neither
// ReadResponse nor Response.Write ever closes a connection.
Close bool
@@ -108,8 +108,8 @@ func (r *Response) Cookies() []*Cookie {
var ErrNoLocation = errors.New("http: no Location header in response")
// Location returns the URL of the response's "Location" header,
-// if present. Relative redirects are resolved relative to
-// the Response's Request. ErrNoLocation is returned if no
+// if present. Relative redirects are resolved relative to
+// the Response's Request. ErrNoLocation is returned if no
// Location header is present.
func (r *Response) Location() (*url.URL, error) {
lv := r.Header.Get("Location")
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go
index 384b453ce0..250e18644c 100644
--- a/src/net/http/serve_test.go
+++ b/src/net/http/serve_test.go
@@ -617,7 +617,7 @@ func TestIdentityResponse(t *testing.T) {
defer ts.Close()
// Note: this relies on the assumption (which is true) that
- // Get sends HTTP/1.1 or greater requests. Otherwise the
+ // Get sends HTTP/1.1 or greater requests. Otherwise the
// server wouldn't have the choice to send back chunked
// responses.
for _, te := range []string{"", "identity"} {
@@ -984,7 +984,7 @@ func TestTLSServer(t *testing.T) {
defer ts.Close()
// Connect an idle TCP connection to this server before we run
- // our real tests. This idle connection used to block forever
+ // our real tests. This idle connection used to block forever
// in the TLS handshake, preventing future connections from
// being accepted. It may prevent future accidental blocking
// in newConn.
@@ -2027,7 +2027,7 @@ func TestHandlerPanicWithHijack(t *testing.T) {
func testHandlerPanic(t *testing.T, withHijack, h2 bool, panicValue interface{}) {
defer afterTest(t)
// Unlike the other tests that set the log output to ioutil.Discard
- // to quiet the output, this test uses a pipe. The pipe serves three
+ // to quiet the output, this test uses a pipe. The pipe serves three
// purposes:
//
// 1) The log.Print from the http server (generated by the caught
@@ -2060,7 +2060,7 @@ func testHandlerPanic(t *testing.T, withHijack, h2 bool, panicValue interface{})
defer cst.close()
// Do a blocking read on the log output pipe so its logging
- // doesn't bleed into the next test. But wait only 5 seconds
+ // doesn't bleed into the next test. But wait only 5 seconds
// for it.
done := make(chan bool, 1)
go func() {
@@ -2205,10 +2205,10 @@ func testRequestBodyLimit(t *testing.T, h2 bool) {
nWritten := new(int64)
req, _ := NewRequest("POST", cst.ts.URL, io.LimitReader(countReader{neverEnding('a'), nWritten}, limit*200))
- // Send the POST, but don't care it succeeds or not. The
+ // Send the POST, but don't care it succeeds or not. The
// remote side is going to reply and then close the TCP
// connection, and HTTP doesn't really define if that's
- // allowed or not. Some HTTP clients will get the response
+ // allowed or not. Some HTTP clients will get the response
// and some (like ours, currently) will complain that the
// request write failed, without reading the response.
//
@@ -2650,7 +2650,7 @@ func TestOptions(t *testing.T) {
}
// Tests regarding the ordering of Write, WriteHeader, Header, and
-// Flush calls. In Go 1.0, rw.WriteHeader immediately flushed the
+// Flush calls. In Go 1.0, rw.WriteHeader immediately flushed the
// (*response).header to the wire. In Go 1.1, the actual wire flush is
// delayed, so we could maybe tack on a Content-Length and better
// Content-Type after we see more (or all) of the output. To preserve
@@ -3107,7 +3107,7 @@ func testTransportAndServerSharedBodyRace(t *testing.T, h2 bool) {
const bodySize = 1 << 20
- // errorf is like t.Errorf, but also writes to println. When
+ // errorf is like t.Errorf, but also writes to println. When
// this test fails, it hangs. This helps debugging and I've
// added this enough times "temporarily". It now gets added
// full time.
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 773dd59c6b..7a27a4157c 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// HTTP server. See RFC 2616.
+// HTTP server. See RFC 2616.
package http
@@ -74,7 +74,7 @@ type ResponseWriter interface {
// Write writes the data to the connection as part of an HTTP reply.
// If WriteHeader has not yet been called, Write calls WriteHeader(http.StatusOK)
- // before writing the data. If the Header does not contain a
+ // before writing the data. If the Header does not contain a
// Content-Type line, Write adds a Content-Type set to the result of passing
// the initial 512 bytes of written data to DetectContentType.
Write([]byte) (int, error)
@@ -342,7 +342,7 @@ type response struct {
requestBodyLimitHit bool
// trailers are the headers to be sent after the handler
- // finishes writing the body. This field is initialized from
+ // finishes writing the body. This field is initialized from
// the Trailer response header when the response header is
// written.
trailers []string
@@ -766,7 +766,7 @@ func (w *response) Header() Header {
// maxPostHandlerReadBytes is the max number of Request.Body bytes not
// consumed by a handler that the server will read from the client
-// in order to keep a connection alive. If there are more bytes than
+// in order to keep a connection alive. If there are more bytes than
// this then the server to be paranoid instead sends a "Connection:
// close" response.
//
@@ -855,8 +855,8 @@ func (h extraHeader) Write(w *bufio.Writer) {
// to cw.res.conn.bufw.
//
// p is not written by writeHeader, but is the first chunk of the body
-// that will be written. It is sniffed for a Content-Type if none is
-// set explicitly. It's also used to set the Content-Length, if the
+// that will be written. It is sniffed for a Content-Type if none is
+// set explicitly. It's also used to set the Content-Length, if the
// total body size was small and the handler has already finished
// running.
func (cw *chunkWriter) writeHeader(p []byte) {
@@ -911,9 +911,9 @@ func (cw *chunkWriter) writeHeader(p []byte) {
// Exceptions: 304/204/1xx responses never get Content-Length, and if
// it was a HEAD request, we don't know the difference between
// 0 actual bytes and 0 bytes because the handler noticed it
- // was a HEAD request and chose not to write anything. So for
+ // was a HEAD request and chose not to write anything. So for
// HEAD, the handler should either write the Content-Length or
- // write non-zero bytes. If it's actually 0 bytes and the
+ // write non-zero bytes. If it's actually 0 bytes and the
// handler never looked at the Request.Method, we just don't
// send a Content-Length header.
// Further, we don't send an automatic Content-Length if they
@@ -965,7 +965,7 @@ func (cw *chunkWriter) writeHeader(p []byte) {
}
// Per RFC 2616, we should consume the request body before
- // replying, if the handler hasn't already done so. But we
+ // replying, if the handler hasn't already done so. But we
// don't want to do an unbounded amount of reading here for
// DoS reasons, so we only try up to a threshold.
if w.req.ContentLength != 0 && !w.closeAfterReply {
@@ -1174,7 +1174,7 @@ func (w *response) bodyAllowed() bool {
// The Life Of A Write is like this:
//
// Handler starts. No header has been sent. The handler can either
-// write a header, or just start writing. Writing before sending a header
+// write a header, or just start writing. Writing before sending a header
// sends an implicitly empty 200 OK header.
//
// If the handler didn't declare a Content-Length up front, we either
@@ -1200,7 +1200,7 @@ func (w *response) bodyAllowed() bool {
// initial header contains both a Content-Type and Content-Length.
// Also short-circuit in (1) when the header's been sent and not in
// chunking mode, writing directly to (4) instead, if (2) has no
-// buffered data. More generally, we could short-circuit from (1) to
+// buffered data. More generally, we could short-circuit from (1) to
// (3) even in chunking mode if the write size from (1) is over some
// threshold and nothing is in (2). The answer might be mostly making
// bufferBeforeChunkingSize smaller and having bufio's fast-paths deal
@@ -1341,7 +1341,7 @@ type closeWriter interface {
var _ closeWriter = (*net.TCPConn)(nil)
// closeWrite flushes any outstanding data and sends a FIN packet (if
-// client is connected via TCP), signalling that we're done. We then
+// client is connected via TCP), signalling that we're done. We then
// pause for a bit, hoping the client processes it before any
// subsequent RST.
//
@@ -1355,7 +1355,7 @@ func (c *conn) closeWriteAndWait() {
}
// validNPN reports whether the proto is not a blacklisted Next
-// Protocol Negotiation protocol. Empty and built-in protocol types
+// Protocol Negotiation protocol. Empty and built-in protocol types
// are blacklisted and can't be overridden with alternate
// implementations.
func validNPN(proto string) bool {
@@ -1433,7 +1433,7 @@ func (c *conn) serve() {
// able to read this if we're
// responding to them and hanging up
// while they're still writing their
- // request. Undefined behavior.
+ // request. Undefined behavior.
io.WriteString(c.rwc, "HTTP/1.1 431 Request Header Fields Too Large\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n431 Request Header Fields Too Large")
c.closeWriteAndWait()
return
@@ -1467,7 +1467,7 @@ func (c *conn) serve() {
// HTTP cannot have multiple simultaneous active requests.[*]
// Until the server replies to this request, it can't read another,
// so we might as well run the handler in this goroutine.
- // [*] Not strictly true: HTTP pipelining. We could let them all process
+ // [*] Not strictly true: HTTP pipelining. We could let them all process
// in parallel even if their responses need to be serialized.
serverHandler{c.server}.ServeHTTP(w, w.req)
if c.hijacked() {
@@ -1488,7 +1488,7 @@ func (w *response) sendExpectationFailed() {
// TODO(bradfitz): let ServeHTTP handlers handle
// requests with non-standard expectation[s]? Seems
// theoretical at best, and doesn't fit into the
- // current ServeHTTP model anyway. We'd need to
+ // current ServeHTTP model anyway. We'd need to
// make the ResponseWriter an optional
// "ExpectReplier" interface or something.
//
@@ -1608,7 +1608,7 @@ func requestBodyRemains(rc io.ReadCloser) bool {
}
// The HandlerFunc type is an adapter to allow the use of
-// ordinary functions as HTTP handlers. If f is a function
+// ordinary functions as HTTP handlers. If f is a function
// with the appropriate signature, HandlerFunc(f) is a
// Handler that calls f.
type HandlerFunc func(ResponseWriter, *Request)
@@ -1779,7 +1779,7 @@ func RedirectHandler(url string, code int) Handler {
// been registered separately.
//
// Patterns may optionally begin with a host name, restricting matches to
-// URLs on that host only. Host-specific patterns take precedence over
+// URLs on that host only. Host-specific patterns take precedence over
// general patterns, so that a handler might register for the two patterns
// "/codesearch" and "codesearch.google.com/" without also taking over
// requests for "http://www.google.com/".
@@ -1968,7 +1968,7 @@ func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
}
// Serve accepts incoming HTTP connections on the listener l,
-// creating a new service goroutine for each. The service goroutines
+// creating a new service goroutine for each. The service goroutines
// read requests and then call handler to reply to them.
// Handler is typically nil, in which case the DefaultServeMux is used.
func Serve(l net.Listener, handler Handler) error {
@@ -1988,10 +1988,10 @@ type Server struct {
// TLSNextProto optionally specifies a function to take over
// ownership of the provided TLS connection when an NPN
- // protocol upgrade has occurred. The map key is the protocol
+ // protocol upgrade has occurred. The map key is the protocol
// name negotiated. The Handler argument should be used to
// handle HTTP requests and will initialize the Request's TLS
- // and RemoteAddr if not already set. The connection is
+ // and RemoteAddr if not already set. The connection is
// automatically closed when the function returns.
// If TLSNextProto is nil, HTTP/2 support is enabled automatically.
TLSNextProto map[string]func(*Server, *tls.Conn, Handler)
@@ -2330,7 +2330,7 @@ type timeoutHandler struct {
body string
// timeout returns the channel of a *time.Timer and
- // cancelTimer cancels it. They're stored separately for
+ // cancelTimer cancels it. They're stored separately for
// testing purposes.
timeout func() <-chan time.Time // returns channel producing a timeout
cancelTimer func() bool // optional
diff --git a/src/net/http/sniff.go b/src/net/http/sniff.go
index 44f83db020..54986b9956 100644
--- a/src/net/http/sniff.go
+++ b/src/net/http/sniff.go
@@ -14,8 +14,8 @@ const sniffLen = 512
// DetectContentType implements the algorithm described
// at http://mimesniff.spec.whatwg.org/ to determine the
-// Content-Type of the given data. It considers at most the
-// first 512 bytes of data. DetectContentType always returns
+// Content-Type of the given data. It considers at most the
+// first 512 bytes of data. DetectContentType always returns
// a valid MIME type: if it cannot determine a more specific one, it
// returns "application/octet-stream".
func DetectContentType(data []byte) string {
diff --git a/src/net/http/transfer.go b/src/net/http/transfer.go
index 7ff4953a14..4c130f0cc4 100644
--- a/src/net/http/transfer.go
+++ b/src/net/http/transfer.go
@@ -276,7 +276,7 @@ func (t *transferReader) protoAtLeast(m, n int) bool {
}
// bodyAllowedForStatus reports whether a given response status code
-// permits a body. See RFC2616, section 4.4.
+// permits a body. See RFC2616, section 4.4.
func bodyAllowedForStatus(status int) bool {
switch {
case status >= 100 && status <= 199:
@@ -379,7 +379,7 @@ func readTransfer(msg interface{}, r *bufio.Reader) (err error) {
}
}
- // Prepare body reader. ContentLength < 0 means chunked encoding
+ // Prepare body reader. ContentLength < 0 means chunked encoding
// or close connection when finished, since multipart is not supported yet
switch {
case chunked(t.TransferEncoding):
@@ -727,11 +727,11 @@ func (b *body) readTrailer() error {
}
// Make sure there's a header terminator coming up, to prevent
- // a DoS with an unbounded size Trailer. It's not easy to
+ // a DoS with an unbounded size Trailer. It's not easy to
// slip in a LimitReader here, as textproto.NewReader requires
- // a concrete *bufio.Reader. Also, we can't get all the way
+ // a concrete *bufio.Reader. Also, we can't get all the way
// back up to our conn's LimitedReader that *might* be backing
- // this bufio.Reader. Instead, a hack: we iteratively Peek up
+ // this bufio.Reader. Instead, a hack: we iteratively Peek up
// to the bufio.Reader's max size, looking for a double CRLF.
// This limits the trailer to the underlying buffer size, typically 4kB.
if !seeUpcomingDoubleCRLF(b.r) {
diff --git a/src/net/http/transport.go b/src/net/http/transport.go
index f622f6f983..163e1bd2b9 100644
--- a/src/net/http/transport.go
+++ b/src/net/http/transport.go
@@ -118,7 +118,7 @@ type Transport struct {
DisableCompression bool
// MaxIdleConnsPerHost, if non-zero, controls the maximum idle
- // (keep-alive) to keep per-host. If zero,
+ // (keep-alive) to keep per-host. If zero,
// DefaultMaxIdleConnsPerHost is used.
MaxIdleConnsPerHost int
@@ -137,7 +137,7 @@ type Transport struct {
// TLSNextProto specifies how the Transport switches to an
// alternate protocol (such as HTTP/2) after a TLS NPN/ALPN
- // protocol negotiation. If Transport dials an TLS connection
+ // protocol negotiation. If Transport dials an TLS connection
// with a non-empty protocol name and TLSNextProto contains a
// map entry for that key (such as "h2"), then the func is
// called with the request's authority (such as "example.com"
@@ -306,7 +306,7 @@ func (t *Transport) RoundTrip(req *Request) (*Response, error) {
// Get the cached or newly-created connection to either the
// host (for http or https), the http proxy, or the http proxy
- // pre-CONNECTed to https server. In any case, we'll be ready
+ // pre-CONNECTed to https server. In any case, we'll be ready
// to send it requests.
pconn, err := t.getConn(req, cm)
if err != nil {
@@ -541,7 +541,7 @@ func (t *Transport) tryPutIdleConn(pconn *persistConn) error {
// We're done with this pconn and somebody else is
// currently waiting for a conn of this type (they're
// actively dialing, but this conn is ready
- // first). Chrome calls this socket late binding. See
+ // first). Chrome calls this socket late binding. See
// https://insouciant.org/tech/connection-management-in-chromium/
t.idleMu.Unlock()
return nil
@@ -666,7 +666,7 @@ func (t *Transport) dial(network, addr string) (net.Conn, error) {
}
// getConn dials and creates a new persistConn to the target as
-// specified in the connectMethod. This includes doing a proxy CONNECT
+// specified in the connectMethod. This includes doing a proxy CONNECT
// and/or setting up TLS. If this doesn't return an error, the persistConn
// is ready to write requests to.
func (t *Transport) getConn(req *Request, cm connectMethod) (*persistConn, error) {
@@ -1558,7 +1558,7 @@ func (pc *persistConn) closeLocked(err error) {
// handlePendingDial's putOrCloseIdleConn when
// it turns out the abandoned connection in
// flight ended up negotiating an alternate
- // protocol. We don't use the connection
+ // protocol. We don't use the connection
// freelist for http2. That's done by the
// alternate protocol's RoundTripper.
} else {
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
index e8a4623556..9f17017651 100644
--- a/src/net/http/transport_test.go
+++ b/src/net/http/transport_test.go
@@ -478,7 +478,7 @@ func TestTransportServerClosingUnexpectedly(t *testing.T) {
// This test has an expected race. Sleeping for 25 ms prevents
// it on most fast machines, causing the next fetch() call to
- // succeed quickly. But if we do get errors, fetch() will retry 5
+ // succeed quickly. But if we do get errors, fetch() will retry 5
// times with some delays between.
time.Sleep(25 * time.Millisecond)
@@ -518,7 +518,7 @@ func TestStressSurpriseServerCloses(t *testing.T) {
// after each request completes, regardless of whether it failed.
// If these are too high, OS X exhausts its ephemeral ports
// and hangs waiting for them to transition TCP states. That's
- // not what we want to test. TODO(bradfitz): use an io.Pipe
+ // not what we want to test. TODO(bradfitz): use an io.Pipe
// dialer for this test instead?
const (
numClients = 20
@@ -1026,7 +1026,7 @@ func TestTransportPersistConnLeak(t *testing.T) {
growth := nfinal - n0
- // We expect 0 or 1 extra goroutine, empirically. Allow up to 5.
+ // We expect 0 or 1 extra goroutine, empirically. Allow up to 5.
// Previously we were leaking one per numReq.
if int(growth) > 5 {
t.Logf("goroutine growth: %d -> %d -> %d (delta: %d)", n0, nhigh, nfinal, growth)
@@ -1067,7 +1067,7 @@ func TestTransportPersistConnLeakShortBody(t *testing.T) {
growth := nfinal - n0
- // We expect 0 or 1 extra goroutine, empirically. Allow up to 5.
+ // We expect 0 or 1 extra goroutine, empirically. Allow up to 5.
// Previously we were leaking one per numReq.
t.Logf("goroutine growth: %d -> %d -> %d (delta: %d)", n0, nhigh, nfinal, growth)
if int(growth) > 5 {
@@ -1103,8 +1103,8 @@ func TestTransportIdleConnCrash(t *testing.T) {
}
// Test that the transport doesn't close the TCP connection early,
-// before the response body has been read. This was a regression
-// which sadly lacked a triggering test. The large response body made
+// before the response body has been read. This was a regression
+// which sadly lacked a triggering test. The large response body made
// the old race easier to trigger.
func TestIssue3644(t *testing.T) {
defer afterTest(t)
@@ -1199,7 +1199,7 @@ func TestTransportConcurrency(t *testing.T) {
// Due to the Transport's "socket late binding" (see
// idleConnCh in transport.go), the numReqs HTTP requests
- // below can finish with a dial still outstanding. To keep
+ // below can finish with a dial still outstanding. To keep
// the leak checker happy, keep track of pending dials and
// wait for them to finish (and be closed or returned to the
// idle pool) before we close idle connections.
@@ -2273,7 +2273,7 @@ func TestTLSServerClosesConnection(t *testing.T) {
}
// byteFromChanReader is an io.Reader that reads a single byte at a
-// time from the channel. When the channel is closed, the reader
+// time from the channel. When the channel is closed, the reader
// returns io.EOF.
type byteFromChanReader chan byte
@@ -2405,7 +2405,7 @@ func (plan9SleepReader) Read(p []byte) (int, error) {
// After the fix to unblock TCP Reads in
// https://golang.org/cl/15941, this sleep is required
// on plan9 to make sure TCP Writes before an
- // immediate TCP close go out on the wire. On Plan 9,
+ // immediate TCP close go out on the wire. On Plan 9,
// it seems that a hangup of a TCP connection with
// queued data doesn't send the queued data first.
// https://golang.org/issue/9554
@@ -2424,7 +2424,7 @@ func (f closerFunc) Close() error { return f() }
// from (or finish writing to) the socket.
//
// NOTE: we resend a request only if the request is idempotent, we reused a
-// keep-alive connection, and we haven't yet received any header data. This
+// keep-alive connection, and we haven't yet received any header data. This
// automatically prevents an infinite resend loop because we'll run out of the
// cached keep-alive connections eventually.
func TestRetryIdempotentRequestsOnError(t *testing.T) {