curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Issue with Http redirect

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 12 Jun 2020 11:00:13 +0200 (CEST)

On Fri, 12 Jun 2020, Amit .. via curl-library wrote:

> Its taking too much time to redirect to actual location which we are getting
> from the response header.

curl doesn't need any extra time to do a redirect, apart from a few cycles to
create the new URL to use...

> It seems that while redirecting from http to https socketcallback
> *(CURLMOPT_SOCKETFUNCTION)* close the socket and opens new socket with same
> socket id , due to which the it stuck at this point.

curl might close the socket after a transfer, yes. That's independent
redirects though.

When a socket has been closed (file descriptor really on *nix), that file
descriptor then becomes free and available for use again when creating a new
socket so there's no suprise that when curl needs a new socket for the next
request - then one the redirect takes you to - the socket gets created to use
the same file descriptor number as the socket that was just recently closed.

That's not a mistake, that's a pretty standard patttern.

That shouldn't be a reason for curl or your application to get stuck though.

> Could you please help me on this issue?

I can't reproduce. We have quite a lot of test cases doing redirects and they
work, even event-based. You need to provide more details about your particular
problem.

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-06-12