HTTP proxy support for peer communication

This commit is contained in:
Christophe Dumez 2010-01-15 16:41:39 +00:00
parent c7ca51f950
commit de50346428
4 changed files with 45 additions and 16 deletions

View file

@ -15,6 +15,7 @@
- FEATURE: Added support for magnet links in search engine
- FEATURE: Added vertor.com and torrentdownloads.net search plugins
- FEATURE: Search engine can now use a SOCKS5 proxy
- FEATURE: HTTP proxy support for peer communication
- BUGFIX: Search engine loads new proxy settings without program restart
- BUGFIX: Use XDG folders (.cache, .local) instead of .qbittorrent
- BUGFIX: Added legal notice on startup that the user must accept

View file

@ -514,6 +514,11 @@ int options_imp::getPeerProxyType() const{
return SOCKS5_PW;
}
return SOCKS5;
case 3:
if(isPeerProxyAuthEnabled()){
return HTTP_PW;
}
return HTTP;
default:
return -1;
}
@ -654,6 +659,10 @@ void options_imp::loadOptions(){
case SOCKS5_PW:
comboProxyType->setCurrentIndex(2);
break;
case HTTP:
case HTTP_PW:
comboProxyType->setCurrentIndex(3);
break;
default:
comboProxyType->setCurrentIndex(0);
}

View file

@ -235,8 +235,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>569</height>
<width>602</width>
<height>590</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
@ -619,8 +619,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>517</height>
<width>644</width>
<height>504</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
@ -1113,8 +1113,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>511</height>
<width>602</width>
<height>514</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
@ -1519,8 +1519,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>388</width>
<height>400</height>
<width>620</width>
<height>495</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
@ -1936,8 +1936,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>357</width>
<height>294</height>
<width>620</width>
<height>495</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@ -2168,6 +2168,11 @@ QGroupBox {
<string>SOCKS5</string>
</property>
</item>
<item>
<property name="text">
<string>HTTP</string>
</property>
</item>
</widget>
</item>
<item>
@ -2359,8 +2364,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>230</width>
<height>109</height>
<width>620</width>
<height>495</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
@ -2456,8 +2461,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>180</width>
<height>214</height>
<width>620</width>
<height>495</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -2620,8 +2625,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>517</height>
<width>620</width>
<height>495</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_24">

View file

@ -174,6 +174,7 @@
<option value="none">_((None))</option>
<option value="socks4">_(SOCKS4)</option>
<option value="socks5">_(SOCKS5)</option>
<option value="http">_(HTTP)</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
_(Host:) <input type="text" id="peer_proxy_host_text" />&nbsp;&nbsp;&nbsp;&nbsp;
_(Port:) <input type="text" id="peer_proxy_port_value" style="width: 4em;"/><br/><br/>
@ -397,6 +398,15 @@
} else {
if(proxy_type_str == "socks4") {
proxy_type = 5;
} else {
if(proxy_type_str == "http") {
if($defined($('peer_proxy_auth_checkbox').get('checked')) && $('peer_proxy_auth_checkbox').get('checked')) {
proxy_type = 3;
proxy_auth_enabled = 1;
} else {
proxy_type = 1;
}
}
}
}
var proxy_ip = $('peer_proxy_host_text').get('value');
@ -810,6 +820,10 @@ loadPreferences = function() {
case 4: // SOCKS5_PW
$('peer_proxy_type_select').set('value', 'socks5');
break;
case 1: // HTTP
case 3: // HTTP_PW
$('peer_proxy_type_select').set('value', 'http');
break;
default: // NONE
$('peer_proxy_type_select').set('value', 'none');
}