Commit 71f05bb
committed
Fix HTTP keep-alive for CouchDB connections
Golang can reuse HTTP connections with keep alive, but the response body
must have been fully read and closed. In the couchdb package, we were
reading the body for sucessful response with a json.Decoder. It only
reads a JSON value, and most responses from CouchDB have an additional
\n after that JSON value. This last byte was not read from the response
body, and it prevents Golang from reusing the connection. So, we are
doing a new HTTP connection (with DNS resolution and TLS handshake) for
each request to CouchDB.1 parent e0e948f commit 71f05bb
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
| |||
322 | 326 | | |
323 | 327 | | |
324 | 328 | | |
325 | | - | |
326 | | - | |
327 | 329 | | |
328 | 330 | | |
329 | 331 | | |
| |||
0 commit comments