Skip to content

Handling closed connections? #1

@jimrobinson

Description

@jimrobinson

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) {
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions