Fixed timeouts for sockets, implemented timeouts in httpclient and fixed
a bug with redirection in httpclient.