OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package httputil provides HTTP utility functions, complementing the | 5 // Package httputil provides HTTP utility functions, complementing the |
6 // more common ones in the net/http package. | 6 // more common ones in the net/http package. |
7 package httputil | 7 package httputil |
8 | 8 |
9 import ( | 9 import ( |
10 "bufio" | 10 "bufio" |
11 "errors" | 11 "errors" |
12 "http" | |
13 "io" | 12 "io" |
14 "net" | 13 "net" |
| 14 "net/http" |
15 "net/textproto" | 15 "net/textproto" |
16 "os" | 16 "os" |
17 "sync" | 17 "sync" |
18 ) | 18 ) |
19 | 19 |
20 var ( | 20 var ( |
21 ErrPersistEOF = &http.ProtocolError{"persistent connection closed"} | 21 ErrPersistEOF = &http.ProtocolError{"persistent connection closed"} |
22 ErrPipeline = &http.ProtocolError{"pipeline error"} | 22 ErrPipeline = &http.ProtocolError{"pipeline error"} |
23 ) | 23 ) |
24 | 24 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 | 410 |
411 // Do is convenience method that writes a request and reads a response. | 411 // Do is convenience method that writes a request and reads a response. |
412 func (cc *ClientConn) Do(req *http.Request) (resp *http.Response, err error) { | 412 func (cc *ClientConn) Do(req *http.Request) (resp *http.Response, err error) { |
413 err = cc.Write(req) | 413 err = cc.Write(req) |
414 if err != nil { | 414 if err != nil { |
415 return | 415 return |
416 } | 416 } |
417 return cc.Read(req) | 417 return cc.Read(req) |
418 } | 418 } |
OLD | NEW |