mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
Fix to for routers that cannot handle many open HTTP-connections
Some routers do not respond when too many subsequent SOAP-requests are sent and will generate an EOF-error in the DefaultClient.Do(req). This modification adds a req.Close = True following the description on http://stackoverflow.com/questions/17714494/golang-http-request-results-in-eof-errors-when-making-multiple-requests-successi
This commit is contained in:
parent
73b9d5c5f9
commit
8d8546868d
@ -452,6 +452,7 @@ func soapRequest(url, service, function, message string) ([]byte, error) {
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
req.Close = true
|
||||
req.Header.Set("Content-Type", `text/xml; charset="utf-8"`)
|
||||
req.Header.Set("User-Agent", "syncthing/1.0")
|
||||
req.Header.Set("SOAPAction", fmt.Sprintf(`"%s#%s"`, service, function))
|
||||
@ -467,6 +468,9 @@ func soapRequest(url, service, function, message string) ([]byte, error) {
|
||||
|
||||
r, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
if debug {
|
||||
l.Debugln(err)
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user