Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Socks5 support #709

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
89 changes: 0 additions & 89 deletions Gemfile.lock

This file was deleted.

12 changes: 7 additions & 5 deletions lib/capybara/webkit/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ def get_cookies

def set_proxy(options = {})
options = default_proxy_options.merge(options)
command("SetProxy", options[:host], options[:port], options[:user], options[:pass])
command "SetProxy", options[:host], options[:port], options[:user],
options[:pass], options[:type]
end

def clear_proxy
Expand Down Expand Up @@ -321,10 +322,11 @@ def read_response

def default_proxy_options
{
:host => "localhost",
:port => "0",
:user => "",
:pass => ""
host: "localhost",

Choose a reason for hiding this comment

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

Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.

port: "0",
user: "",
pass: "",
type: "http"

Choose a reason for hiding this comment

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

Put a comma after the last item of a multiline hash.

}
end
end
Expand Down
13 changes: 7 additions & 6 deletions src/SetProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ void SetProxy::start()
// default to empty proxy
QNetworkProxy proxy;

if (arguments().size() > 0)
proxy = QNetworkProxy(QNetworkProxy::HttpProxy,
arguments()[0],
(quint16)(arguments()[1].toInt()),
arguments()[2],
arguments()[3]);
if (arguments().size() > 0) {
proxy.setType((arguments()[4] == "socks5") ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy);
proxy.setHostName(arguments()[0]);
proxy.setPort((quint16)(arguments()[1].toInt()));
proxy.setUser(arguments()[2]);
proxy.setPassword(arguments()[3]);
}

manager()->networkAccessManager()->setProxy(proxy);
finish(true);
Expand Down