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

curl_easy_getinfo CURLINFO_EFFECTIVE_URL is the same for all handles created in the PUSHFUNCTION callback #5589

Closed
JCMais opened this issue Jun 23, 2020 · 1 comment

Comments

@JCMais
Copy link
Contributor

@JCMais JCMais commented Jun 23, 2020

When using libcurl multi handle with the PUSHFUNCTION option set to allow PUSH_PROMISE frames, if you call curl_get_info(handle, CURLINFO_EFFECTIVE_URL, &result) on one of the handles libcurl created, it returns the URL of the original easy handle.

I don't know if this is the intended behavior or a possible bug, so I'm opening this issue here.

If this is in fact the intended behavior, a new info option to retrieve the pushed data URL would be very helpful, or at least some kind of flag saying this easy handle was created to transfer data pushed by the server.

I know this is possible by passing a custom structure to the CURLOPT_PRIVATE option of each handle, but in my particular scenario, this option is already bound to something else.

I did this

Ran the example at https://curl.haxx.se/libcurl/c/http2-pushinmemory.html with some minor edits:

  1. Changed URL to https://http2.golang.org/serverpush
  2. Allowed all pushes on CURLMOPT_PUSHFUNCTION callback
  3. Called curl_easy_getinfo(e, CURLINFO_EFFECTIVE_URL, &result); before curl_easy_cleanup(e); in the do/while loop.

It shows the same URL for all requests.

I expected the following

Different URLs for each easy handle.

curl/libcurl version

Version: libcurl/7.69.1-DEV OpenSSL/1.1.1d zlib/1.2.11 WinIDN libssh2/1.9.0_DEV nghttp2/1.40.0
Protocols: dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Features: AsynchDNS, IDN, IPv6, Largefile, SSPI, Kerberos, SPNEGO, NTLM, SSL, libz, HTTP2, HTTPS-proxy

operating system

Windows 10 x64

@bagder
Copy link
Member

@bagder bagder commented Jun 23, 2020

I think it is an omission (bug). The pushed stream gets its 'easy' handle created internally by duplicating the "source stream", which is why it gets that particular effective URL. It simply isn't updated to the correct URL.

It probably makes sense for curl to create the URL proper to allow CURLINFO_EFFECTIVE_URL to work exactly the way you tried to use it.

bagder added a commit that referenced this issue Jun 23, 2020
...previously CURLINFO_EFFECTIVE_URL would report the URL of the
original "mother transfer", not the actually pushed resource.

Reported-by: Jonathan Cardoso Machado
Fixes #5589
bagder added a commit that referenced this issue Jun 23, 2020
...previously CURLINFO_EFFECTIVE_URL would report the URL of the
original "mother transfer", not the actually pushed resource.

Reported-by: Jonathan Cardoso Machado
Fixes #5589
@bagder bagder closed this in 646cc57 Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.