Summary: | freebsd-update(8) fetch fails because phttpget fails proxy auth | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | David <datechy+bsd> | ||||||
Component: | bin | Assignee: | Bugmeister <bugmeister> | ||||||
Status: | Closed Overcome By Events | ||||||||
Severity: | Affects Only Me | CC: | emaste, gndaryee, grahamperrin, stevekamau87, tim | ||||||
Priority: | Normal | ||||||||
Version: | 7.0-RELEASE | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
David
2008-12-05 07:50:01 UTC
Responsible Changed From-To: freebsd-bugs->cperciva Over to maintainer. Hello, Probably this patch would help on HTTP_PROXY=http://user:pwd@proxy.example.com:8080 problem. Best regards, Normunds Hi I applied the submitted patch to phttpget and tested it on one of our lab machines that runs FreeBSD 9.0-Release amd64 and sits behind a HTTP proxy with required authentication. The patch worked without a problem. This patch would also solve misc/126131. //Ted Henriksson Hi, Just reporting that Normunds' patch worked for me too. FreeBSD 9.0-Release amd64 behind a HTTP proxy server with required authentication. Kind Regards, Stephen K. Karanja batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed. I found the root cause. There's a bug with the Base64 Encoding within the b64enc function. The Filling isn't applied in most of the cases. For example: "Hey:Base64" should be encoded to "SGV5OkJhc2U2NA==" But due to wrong filling it's getting encoded to "SGV5OkJhc2U2NAA=". This can be replicated with every "username:password" combination where the combined length is not a multiple of 3 (due to the issue when filling comes in place). So "H:B", "HE:Bas" and "Hey:Base6" as username and Password are fine for example. Should be easy to replicate for the maintainer. I tested it myself with another Base64 Encoding Implementation by Jouni Melinen (which is apparently the fastest) and it worked flawlessly. Created attachment 201165 [details]
b64enc fix and use fetch API
Concerning how phttpget parses HTTP_PROXY, I would suggest using fetchParseURL from <fetch.h> instead of parsing it manually (similar to how http_get_proxy() is handled). That way we can ensure it's parsed the same way as "fetch" does.
Additionally it seems like there's an off-by-one error in b64enc.
This patch showcases how the fetch API could be used and fixes b64enc.
Drop freebsd-update PRs which were assigned to me. I'm not working on this code any more. ^Triage: portsnap was removed from -CURRENT 20230420, which renders these patches Overcome By Events. |