Skip to content

Parse Proxy Auto-Configuration strings#9127

Merged
outofambit merged 17 commits intodevelopmentfrom
pac-parser
Feb 19, 2020
Merged

Parse Proxy Auto-Configuration strings#9127
outofambit merged 17 commits intodevelopmentfrom
pac-parser

Conversation

@niik
Copy link
Member

@niik niik commented Feb 17, 2020

I'm extracting the PAC parser from my ongoing work to better support proxies in order to lessen the review burden of the final work. Note that this PR will add an unused function and that's okay.

In order to know what to tell Git (or cURL rather) what (if any) proxy it should be using we'll first need to figure out what the system is set up to use. For that we'll leverage the, poorly documented, resolveProxy method in Electron. The method returns a PAC string which we'll need to parse in order to convert it to something that's usable for cURL which is the entire purpose of this method.

The code is documented (perhaps overly so) with several references that's useful if you've never heard of PAC files or PAC strings. The best primer IMO is MDN's article on PAC files.

We don't have to support all the weird variants or the raw output of an actual FindProxyForURL if a user's organization has one set up since Chromium will do an initial parsing round and reformat before handing it off to us.

TL;DR Chops and mashes some strings with more documentation than logic

Copy link
Contributor

@outofambit outofambit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding tests, that really helped with understanding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants