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

REG [7.81->7.82] Authorization doesn't work for user in URL + netrc #9243

Closed
orgads opened this issue Aug 3, 2022 · 0 comments
Closed

REG [7.81->7.82] Authorization doesn't work for user in URL + netrc #9243

orgads opened this issue Aug 3, 2022 · 0 comments

Comments

@orgads
Copy link
Contributor

orgads commented Aug 3, 2022

I did this

I have username in netrc, but if I provide a username in the URL, none of them is used, and no Authorization header is sent (even if it is the same user).

Example:
.netrc:

machine server login user password 5up3r53cr31
$ curl -n http://user@server/
Unauthorized

The issue is caused by (and fixed by reverting) d1237ac.

I expected the following

I expect it to send Authorization header.

curl/libcurl version

curl 7.84.0 (x86_64-w64-mingw32) libcurl/7.84.0 OpenSSL/1.1.1q (Schannel) zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.48.0
Release-Date: 2022-06-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL SSPI threadsafe TLS-SRP zstd

operating system

Windows 10

orgads added a commit to orgads/curl that referenced this issue Aug 4, 2022
If the user is specified as part of the URL, and the same user exists
in .netrc, Authorization header was not sent at all.

The user and password fields were assigned in conn->user and password
but the user was not assigned to data->state.aptr, which is the field
that is used in output_auth_headers and friends.

Fix by assigning the user also to aptr.

Amends commit d1237ac.

- Fixes curl#9243
orgads added a commit to orgads/curl that referenced this issue Aug 18, 2022
If the user is specified as part of the URL, and the same user exists
in .netrc, Authorization header was not sent at all.

The user and password fields were assigned in conn->user and password
but the user was not assigned to data->state.aptr, which is the field
that is used in output_auth_headers and friends.

Fix by assigning the user also to aptr.

Amends commit d1237ac.

- Fixes curl#9243
@bagder bagder closed this as completed in c40ec31 Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants