Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling closed connections? #1

Open
jimrobinson opened this issue Aug 18, 2010 · 0 comments
Open

Handling closed connections? #1

jimrobinson opened this issue Aug 18, 2010 · 0 comments

Comments

@jimrobinson
Copy link

Given that httplib is using http.ClientConn, is it Expected that the library not handle the server closing an idle connection on the client?

Otherwise would a change along the following lines be needed to reconnect,
renaming the original Request() method as request() and then having some
logic for re-trying in the public method?

func (client _Client) Request(rawurl string, method string, headers map[string]string, body string) (_http.Response, os.Error) {
resp, err := client.request(rawurl, method, headers, body)
if err == io.ErrUnexpectedEOF && (method == "GET" || method == "HEAD") {
if client.conn != nil {
client.conn.Close()
}
client.conn = nil
resp, err = client.request(rawurl, method, headers, body)
}
return resp, err
}

func (client _Client) request(rawurl string, method string, headers map[string]string, body string) (_http.Response, os.Error) {
...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant