Summary: | fetch(1) fails to handle redirects on a valid URL | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Yuri Victorovich <yuri> | ||||||
Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
Status: | New --- | ||||||||
Severity: | Affects Only Me | CC: | pprocacci, ronald-lists | ||||||
Priority: | --- | ||||||||
Version: | 12.1-STABLE | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Yuri Victorovich
2020-01-12 19:42:01 UTC
To clarify the issue: $ fetch -v "https://www.tddft.org/programs/libxc/down.php?file=4.3.4/libxc-4.3.4.tar.gz" resolving server address: www.tddft.org:443 SSL options: 82004854 Peer verification enabled Using CA cert file: /usr/local/etc/ssl/cert.pem Verify hostname TLSv1.2 connection established using ECDHE-RSA-AES256-GCM-SHA384 Certificate subject: /CN=tddft.org Certificate issuer: /C=US/O=Let's Encrypt/CN=R3 requesting https://www.tddft.org/programs/libxc/down.php?file=4.3.4/libxc-4.3.4.tar.gz 302 redirect to down/4.3.4/libxc-4.3.4.tar.gz resolving server address: down:0 fetch: https://www.tddft.org/programs/libxc/down.php?file=4.3.4/libxc-4.3.4.tar.gz: No address record Fetch tries "down" as the server name of the next hop. Created attachment 236031 [details]
Add support for relative urls in redirect responses
RFC 7231 has support for relative urls.
I saw this bug report and had to check. I didn't believe it.
The attach patch fixes the op's issue, but truly it needs to be tested with all kinds of responses.
Additionally, I program in C in a much much different way than the source file's layout. Safe to apply, sure, but it'd be wise for someone else to give it a once over to ensure it conforms to your standards; something someone else can do if they so choose.
Created attachment 236032 [details]
Updated patch to support redirected relative urls to fetch.
Just added the check to the return of the function .... Hey it's 3am ... sheesh!
|