libgit2: enforce timeouts for http transports

Attach context to HTTP requests at the transport level to honour
timeouts.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
This commit is contained in:
Sanskar Jaiswal 2022-07-09 19:07:22 +05:30
parent a252532c65
commit cd03c26083
1 changed files with 1 additions and 0 deletions

View File

@ -419,6 +419,7 @@ func (self *httpSmartSubtransportStream) sendRequest() error {
URL: self.req.URL, URL: self.req.URL,
Header: self.req.Header, Header: self.req.Header,
} }
req = req.WithContext(self.owner.ctx)
if req.Method == "POST" { if req.Method == "POST" {
if len(content) == 0 { if len(content) == 0 {