MCPcopy Index your code
hub / github.com/imroc/req / shouldClose

Function shouldClose

transfer.go:683–699  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

681// receiving a response and body
682// 'header' is the request headers.
683func 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.
702func fixTrailer(header http.Header, chunked bool) (http.Header, error) {

Callers 1

readTransferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…