Use remove and add instead of update_handler in curl_httpclient.

Curl sometimes fails to tell us that it has closed a socket
and reopened a new one with the same file descriptor, leading
to problems in some IOLoops.  This should fix the recurring problem
of update_handler errors in various less-common use cases.

Closes #801.
Closes #538.