@@ -99,30 +99,37 @@ type Request struct {
99
99
ProtoMajor int // 1
100
100
ProtoMinor int // 0
101
101
102
- // A header maps request lines to their values.
103
- // If the header says
102
+ // Header contains the request header fields either received
103
+ // by the server or to be sent by the client.
104
104
//
105
+ // If a server received a request with header lines,
106
+ //
107
+ // Host: example.com
105
108
// accept-encoding: gzip, deflate
106
109
// Accept-Language: en-us
107
- // Connection: keep-alive
110
+ // fOO: Bar
111
+ // foo: two
108
112
//
109
113
// then
110
114
//
111
115
// Header = map[string][]string{
112
116
// "Accept-Encoding": {"gzip, deflate"},
113
117
// "Accept-Language": {"en-us"},
114
- // "Connection ": {"keep-alive "},
118
+ // "Foo ": {"Bar", "two "},
115
119
// }
116
120
//
117
- // HTTP defines that header names are case-insensitive.
118
- // The request parser implements this by canonicalizing the
119
- // name, making the first character and any characters
120
- // following a hyphen uppercase and the rest lowercase.
121
+ // For incoming requests, the Host header is promoted to the
122
+ // Request.Host field and removed from the Header map.
121
123
//
122
- // For client requests certain headers are automatically
123
- // added and may override values in Header.
124
+ // HTTP defines that header names are case-insensitive. The
125
+ // request parser implements this by using CanonicalHeaderKey,
126
+ // making the first character and any characters following a
127
+ // hyphen uppercase and the rest lowercase.
124
128
//
125
- // See the documentation for the Request.Write method.
129
+ // For client requests, certain headers such as Content-Length
130
+ // and Connection are automatically written when needed and
131
+ // values in Header may be ignored. See the documentation
132
+ // for the Request.Write method.
126
133
Header Header
127
134
128
135
// Body is the request's body.
@@ -152,8 +159,15 @@ type Request struct {
152
159
TransferEncoding []string
153
160
154
161
// Close indicates whether to close the connection after
155
- // replying to this request (for servers) or after sending
156
- // the request (for clients).
162
+ // replying to this request (for servers) or after sending this
163
+ // request and reading its response (for clients).
164
+ //
165
+ // For server requests, the HTTP server handles this automatically
166
+ // and this field is not needed by Handlers.
167
+ //
168
+ // The client requests, setting this field prevents re-use of
169
+ // TCP connections between requests to the same hosts, as if
170
+ // Transport.DisableKeepAlives were set.
157
171
Close bool
158
172
159
173
// For server requests Host specifies the host on which the
0 commit comments