Determine whether to hang up after sending a request and body, or receiving a response and body 'header' is the request headers.
(major, minor int, header http.Header, removeCloseHeader bool)
| 681 | // receiving a response and body |
| 682 | // 'header' is the request headers. |
| 683 | func shouldClose(major, minor int, header http.Header, removeCloseHeader bool) bool { |
| 684 | if major < 1 { |
| 685 | return true |
| 686 | } |
| 687 | |
| 688 | conv := header["Connection"] |
| 689 | hasClose := httpguts.HeaderValuesContainsToken(conv, "close") |
| 690 | if major == 1 && minor == 0 { |
| 691 | return hasClose || !httpguts.HeaderValuesContainsToken(conv, "keep-alive") |
| 692 | } |
| 693 | |
| 694 | if hasClose && removeCloseHeader { |
| 695 | header.Del("Connection") |
| 696 | } |
| 697 | |
| 698 | return hasClose |
| 699 | } |
| 700 | |
| 701 | // Parse the trailer header. |
| 702 | func fixTrailer(header http.Header, chunked bool) (http.Header, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…