Skip to content

Add option (-s) to explicitly specify the URL scheme#14

Open
0xced wants to merge 1 commit intowilliambailey:masterfrom
0xced:url-scheme
Open

Add option (-s) to explicitly specify the URL scheme#14
0xced wants to merge 1 commit intowilliambailey:masterfrom
0xced:url-scheme

Conversation

@0xced
Copy link

@0xced 0xced commented Jun 14, 2022

Explicitly specifying the URL scheme might be required depending on how the PAC file is written. For example, if the script returns a different value based on the URL scheme then passing the full URL to the FindProxyForURL method might be required.

Here's an example of such a (real life) PAC script:

if ((url.substring(0,5) != "http:") && (url.substring(0,6) != "https:"))
return "DIRECT";

Since the request URL scheme is not known, passing it explicitly through a command line option solves this issue.

The README has also been updated to reflect the intended usage of the new -s option.

Please bear in mind that this is the first time I ever write some go code. 😇

Explicitly specifying the URL scheme might be required depending on how the PAC file is written. For example, if the script returns a different value based on the URL scheme then passing the full URL to the `FindProxyForURL` method might be required.

Here's an example of such a (real life) PAC script:

```js
if ((url.substring(0,5) != "http:") && (url.substring(0,6) != "https:"))
return "DIRECT";
```

Since the [request URL scheme is not known][1], passing it explicitly through a command line option solves this issue.

The README has also been updated to reflect the intended usage of the new `-s` option.

Please bear in mind that this is the first time I ever write some go code. 😇

[1]: golang/go#28940
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant