Bug 180408

Summary: WebDriver: implement proxy support
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebDriverAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, berto, clopez, ews-watchlist, gustavo, hi, joepeck, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch clopez: review+, clopez: commit-queue-

Carlos Garcia Campos
Reported 2017-12-05 02:54:29 PST
Attachments
Patch (25.22 KB, patch)
2019-11-08 01:06 PST, Carlos Garcia Campos
no flags
Patch (27.51 KB, patch)
2019-11-11 02:36 PST, Carlos Garcia Campos
clopez: review+
clopez: commit-queue-
Blaze Burg
Comment 1 2018-01-30 09:14:17 PST
safaridriver work tracked by <rdar://problem/36854985>. For safaridriver, we'd need WKWebView support for proxy settings that hook into the NSURLSession. I suppose other network stacks have similar settings to propagate.
Carlos Garcia Campos
Comment 2 2019-11-08 01:06:37 PST
EWS Watchlist
Comment 3 2019-11-08 01:07:36 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Carlos Alberto Lopez Perez
Comment 4 2019-11-08 05:06:28 PST
Comment on attachment 383117 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=383117&action=review > Source/WebDriver/WebDriverService.cpp:367 > + if (proxy.type == "pac") { > + String autoconfigURL; > + if (!proxyObject.getString("proxyAutoconfigUrl"_s, autoconfigURL)) > + return WTF::nullopt; > + > + proxy.autoconfigURL = autoconfigURL; > + return proxy; > + } This type of proxy doesn't seem to be handled. Maybe returning an error is more according to the spec than silently accepting it and ignoring it? > Source/WebDriver/WebDriverService.cpp:415 > + if (proxyObject.getValue("socksProxy", value)) { > + String socksProxy; > + if (!value->asString(socksProxy)) > + return WTF::nullopt; > + > + proxy.socksURL = URL({ }, makeString("socks://", socksProxy)); > + if (!proxy.socksURL->isValid()) > + return WTF::nullopt; > + > + RefPtr<JSON::Value> socksVersionValue; > + if (!proxyObject.getValue("socksVersion", socksVersionValue)) > + return WTF::nullopt; > + > + auto socksVersion = unsignedValue(*socksVersionValue); > + if (!socksVersion || socksVersion.value() > 255) > + return WTF::nullopt; > + proxy.socksVersion = socksVersion.value(); > + } socksVersionValue seems to be ignored when constructing socksURL. It is true that webkit_network_proxy_settings_add_proxy_for_scheme() works with the three types of sock proxies if not a specific version is specified, but I think its better to be specific here is the user/application has requested a specific type of proxy. This is my suggestion: * proxy.socksURL should start with: - if socksVersionValue is invalid/missing or anything other than 4 or 5 -> socks:// - if socksVersionValue is 4 and socksURL is an IP Adresss -> socks4:// - if socksVersionValue is 4 and socksURL is a domain name -> socks4a:// - if socksVersionValue is 5 -> socks5://
Carlos Garcia Campos
Comment 5 2019-11-08 06:06:04 PST
Comment on attachment 383117 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=383117&action=review >> Source/WebDriver/WebDriverService.cpp:367 >> + } > > This type of proxy doesn't seem to be handled. > Maybe returning an error is more according to the spec than silently accepting it and ignoring it? Yes, I thought about it, I'll add a way to ask platform is a particular proxy types is supported. >> Source/WebDriver/WebDriverService.cpp:415 >> + } > > socksVersionValue seems to be ignored when constructing socksURL. > It is true that webkit_network_proxy_settings_add_proxy_for_scheme() works with the three types of sock proxies if not a specific version is specified, but I think its better to be specific here is the user/application has requested a specific type of proxy. > > This is my suggestion: > * proxy.socksURL should start with: > - if socksVersionValue is invalid/missing or anything other than 4 or 5 -> socks:// > - if socksVersionValue is 4 and socksURL is an IP Adresss -> socks4:// > - if socksVersionValue is 4 and socksURL is a domain name -> socks4a:// > - if socksVersionValue is 5 -> socks5:// I had no idea how to specify the socks version, I'll do what you suggest here.
Carlos Garcia Campos
Comment 6 2019-11-11 02:36:59 PST
Carlos Alberto Lopez Perez
Comment 7 2019-11-11 05:28:12 PST
Comment on attachment 383257 [details] Patch r=me. Thanks! But before landing check build on wincairo EWS: It broke because platformSupportProxyType() is not defined there.
Carlos Garcia Campos
Comment 8 2019-11-11 07:13:56 PST
I forgot there's wincairo implementation of WebDriver
Carlos Garcia Campos
Comment 9 2019-11-11 07:16:23 PST
Radar WebKit Bug Importer
Comment 10 2019-11-11 16:57:47 PST
Note You need to log in before you can comment on or make changes to this bug.