Closed Bug 1359693 Opened 7 years ago Closed 7 years ago

WebExtensions ProxyAPI: FindProxyForURL() return string format

Categories

(WebExtensions :: Untriaged, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX
webextensions ?

People

(Reporter: ericjung, Unassigned)

References

Details

(Whiteboard: [proxy][triaged])

The information returned by FindProxyByURL() is precisely the same information needed to compose a URL:

* protocol (or proxy type; e.g PROXY/HTTP, SOCKS, HTTPS)
* host
* port
* if bug 1359543 proceeds, then also username and password

As specified in the URL/URI RFCs https://tools.ietf.org/html/rfc3986#section-3  and https://tools.ietf.org/html/rfc2396#section-3.2.2 and previously by convention, URLs are specified in this format:

scheme://username:password@host:port

(scheme is the more general term for protocol)

Yet the string format returned by FindProxyByURL() is:

PROTOCOL host:port

For example, PROXY foo.com:3128 or SOCKS bar.com:1080

This format is antiquated and dates to the early 1990s. It does not consider the aforementioned convention and specification.

I propose FindProxyForPAC() -- for WebExtension ProxyAPI only -- be permitted to return the widely-used URL format. Examples:

http://someproxyserveroverthere.com (HTTP proxy server on port 3128)
http://eric:l33tpassw0rd@foxyproxy.com:2112 (HTTP proxy server on port 2112 requiring HTTP Basic Auth)
https://eric:l33tpassw0rd@foxyproxy.com:2112 (HTTP Secure or HTTP over SSL/TLS proxy server on port 2112 requiring HTTP Basic Auth)
https://someproxyserveroverthere.com (HTTP Secure or HTTP over SSL/TLS proxy server on port 443 requiring HTTP Basic Auth)
socks5://matt:passwerdz@mozilla.org:19191 (SOCKS5 proxy server with auth, port 19191)
socks5://mysocksproxy.mozilla.org (SOCKS5 proxy server, no auth, port 1080)
socks4a://matt:passwerdz@mozilla.org:777 (SOCKS4a proxy server, with auth, port 777)
socks4://mozilla.org:19191 (socks 4 proxy servers do not support un/pw auth)
wpad://192.168.1.1/proxy.pac (WPAD file at specified URL)

username, password, and port are optional.

Protocol/Schemes:
* http:  -- the proxy server is an HTTP proxy server
* https: -- the proxy server is an HTTP Secure or HTTP over SSL/TLS proxy server [0]
* socks5: -- the proxy server is a SOCKS 5 proxy server
* socks4a: -- the proxy server is a SOCKS4a proxy server
* socks4: -- the proxy server is a SOCKS4 proxy server
* wpad:  determine the PAC script using this WPAD url

- scheme/protocol is required
- username and password are optional. No defaults.
- host is required
- port is optional but if not specified, the default port for that proxy server type is assumed [1]:

HTTP ==> 8080
HTTPS ==> 443 (I think?)
SOCKS5, SOCKS4, SOCKS4a ==> 1080
WPAD ==> none

There are already XPCOM components to parse URLs into component parts [2].

"direct" and "system" will still be needed as return types (non-URL format) as discussed in the Proxy API Design Proposal [3].

[0] http://wiki.squid-cache.org/Features/HTTPS
[1] http://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-sg-en-4/ch-ports.html
[2] https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIURLParser
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIIOService#extractScheme()
and possibly https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIURL
or https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStandardURL
[3] https://docs.google.com/document/d/1W45o5X2bFRPrTaQDFp9IzTJ8njCVfEgyENS7i2owaUI
Blocks: 1359543
webextensions: --- → ?
Priority: -- → P2
Whiteboard: [proxy][triaged]
Superceded by bug 1381290
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.