public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows
5+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows
@ 2017-05-18 14:42  Neel Patel <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Neel Patel @ 2017-05-18 14:42 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Dave,

Please find attached patch for the fix of RM#2398 - "Proxy not bypassed for
embedded server in runtime on Windows".

*Observation:-*
We have observed this issue only with Qt WebEngine. We have not observed
this issue with Webkit ( Tested with Qt 5.3 ).

*Issue:-*
If user set option "Bypass proxy server for local addresses" then WebEngine
doesn't bypass the request for local addresses even if that option is set.

*Solution:-*
Now if user set option "Bypass proxy server for local addresses" then Web
Engine bypass the request for localhost and if user unset then request will
not be bypassed.

Please find attached fix for this issue. Do review and test it and let me
know for any issue.

Thanks,
Neel Patel


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM_2398.patch (676B, 3-RM_2398.patch)
  download | inline diff:
diff --git a/runtime/pgAdmin4.cpp b/runtime/pgAdmin4.cpp
index a2dbe74..865e6ad 100644
--- a/runtime/pgAdmin4.cpp
+++ b/runtime/pgAdmin4.cpp
@@ -327,6 +327,12 @@ int main(int argc, char * argv[])
     browserWindow.setWindowIcon(QIcon(":/pgAdmin4.ico"));
     browserWindow.show();
 
+    // Disable platform specific proxy settings.
+    // This is required for QtWebEngine on windows platform.
+    // If user has already set the proxy server then "Bypass proxy for localhost"
+    // options is required to enable to make the application working.
+    QNetworkProxyFactory::setUseSystemConfiguration(false);
+
     // Go!
     splash->finish(NULL);
     return app.exec();


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows
@ 2017-05-19 11:07  Dave Page <[email protected]>
  parent: Neel Patel <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Dave Page @ 2017-05-19 11:07 UTC (permalink / raw)
  To: Neel Patel <[email protected]>; +Cc: pgadmin-hackers

On Thu, May 18, 2017 at 3:42 PM, Neel Patel <[email protected]> wrote:
> Hi Dave,
>
> Please find attached patch for the fix of RM#2398 - "Proxy not bypassed for
> embedded server in runtime on Windows".
>
> Observation:-
> We have observed this issue only with Qt WebEngine. We have not observed
> this issue with Webkit ( Tested with Qt 5.3 ).
>
> Issue:-
> If user set option "Bypass proxy server for local addresses" then WebEngine
> doesn't bypass the request for local addresses even if that option is set.
>
> Solution:-
> Now if user set option "Bypass proxy server for local addresses" then Web
> Engine bypass the request for localhost and if user unset then request will
> not be bypassed.
>
> Please find attached fix for this issue. Do review and test it and let me
> know for any issue.

Noted on the ticket:

====
Right, but as Maxim has noted, the proxy code is there to allow users
to browse to online docs, so it can't just be disabled.

This likely worked in 1.3 as that used QtWebEngine (which had a bunch
of other issues). We need to fix it for QtWebKit, so that it honors
the bypass proxy for local addresses option.
====


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows
@ 2017-05-24 08:22  Neel Patel <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Neel Patel @ 2017-05-24 08:22 UTC (permalink / raw)
  To: Dave Page <[email protected]>; [email protected]; +Cc: pgadmin-hackers

--94eb2c0c0bcedd91ca055040cc6a
Content-Type: multipart/alternative; boundary="94eb2c0c0bcedd91c5055040cc68"

--94eb2c0c0bcedd91c5055040cc68
Content-Type: text/plain; charset="UTF-8"

Hi,

After debugging the issue in windows, we came to know that "random port"
generation logic in runtime is getting failed if we configured proxy server
in windows.

Below are the code where we are finding random free port and use with our
URL "localhost:<port>". Below code return "0" as port value so application
is not able to start and it hangs on splash screen. Here, if we configured
proxy server in windows then "bind" method always return false and gives
message "Operation not permitted" but when we disable proxy server then
below code gives valid random port number.

QTcpSocket socket;
socket.bind(0, QTcpSocket::ShareAddress);
port = socket.localPort();

Same happens with Linux OS - when user defined "http_proxy" environment
variable and run pgAdmin4 application then above code fails and gives "0"
as random port number and application hangs on splash screen.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows
@ 2017-05-24 17:53  Dave Page <[email protected]>
  parent: Neel Patel <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Dave Page @ 2017-05-24 17:53 UTC (permalink / raw)
  To: Neel Patel <[email protected]>; +Cc: Maxim Zakharov <[email protected]>; pgadmin-hackers

Good catch - thanks Neel. I don't have my main dev laptop with me, so
I'll have to test this next week. Watch this space :-)

On Wed, May 24, 2017 at 4:22 AM, Neel Patel <[email protected]> wrote:
> Hi,
>
> After debugging the issue in windows, we came to know that "random port"
> generation logic in runtime is getting failed if we configured proxy server
> in windows.
>
> Below are the code where we are finding random free port and use with our
> URL "localhost:<port>". Below code return "0" as port value so application
> is not able to start and it hangs on splash screen. Here, if we configured
> proxy server in windows then "bind" method always return false and gives
> message "Operation not permitted" but when we disable proxy server then
> below code gives valid random port number.
>
> QTcpSocket socket;
> socket.bind(0, QTcpSocket::ShareAddress);
> port = socket.localPort();
>
> Same happens with Linux OS - when user defined "http_proxy" environment
> variable and run pgAdmin4 application then above code fails and gives "0" as
> random port number and application hangs on splash screen.
>
>
> From the below Qt 5.8 released link, we came to know that "random port"
> generation work well after setting application level proxy.
> http://blog.qt.io/blog/2017/01/23/qt-5-8-released/
>
> QNetworkProxy::setApplicationProxy(QNetworkProxy());
>
> After setting above, "bind" method return true and gives correct port number
> and application starts working. We are also setting
> "setUseSystemConfiguration=true" after setting application level proxy which
> will override the setting and use platform specific system proxy
> configuration.
>
> From the below link, it looks like fixed in Qt 5.9.
> https://bugreports.qt.io/browse/QTBUG-58374
> https://codereview.qt-project.org/#/c/186124/
>
> I have tested with Qt 5.8 Web Engine and webkit in windows. Do review it and
> let me know for comments.
>
> Thanks,
> Neel Patel
>
> On Fri, May 19, 2017 at 4:37 PM, Dave Page <[email protected]> wrote:
>>
>> On Thu, May 18, 2017 at 3:42 PM, Neel Patel <[email protected]>
>> wrote:
>> > Hi Dave,
>> >
>> > Please find attached patch for the fix of RM#2398 - "Proxy not bypassed
>> > for
>> > embedded server in runtime on Windows".
>> >
>> > Observation:-
>> > We have observed this issue only with Qt WebEngine. We have not observed
>> > this issue with Webkit ( Tested with Qt 5.3 ).
>> >
>> > Issue:-
>> > If user set option "Bypass proxy server for local addresses" then
>> > WebEngine
>> > doesn't bypass the request for local addresses even if that option is
>> > set.
>> >
>> > Solution:-
>> > Now if user set option "Bypass proxy server for local addresses" then
>> > Web
>> > Engine bypass the request for localhost and if user unset then request
>> > will
>> > not be bypassed.
>> >
>> > Please find attached fix for this issue. Do review and test it and let
>> > me
>> > know for any issue.
>>
>> Noted on the ticket:
>>
>> ====
>> Right, but as Maxim has noted, the proxy code is there to allow users
>> to browse to online docs, so it can't just be disabled.
>>
>> This likely worked in 1.3 as that used QtWebEngine (which had a bunch
>> of other issues). We need to fix it for QtWebKit, so that it honors
>> the bypass proxy for local addresses option.
>> ====
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows
@ 2017-05-30 14:51  Dave Page <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Dave Page @ 2017-05-30 14:51 UTC (permalink / raw)
  To: Neel Patel <[email protected]>; +Cc: Maxim Zakharov <[email protected]>; pgadmin-hackers

I've applied the patch from Neel for this in
commit:6e24cb038a0498cf87219104368dfcea40630440 and put a test build
at https://developer.pgadmin.org/~dpage/pgadmin4-1.5-x86.exe. Please
test!

Thanks Neel!

On Wed, May 24, 2017 at 6:53 PM, Dave Page <[email protected]> wrote:
> Good catch - thanks Neel. I don't have my main dev laptop with me, so
> I'll have to test this next week. Watch this space :-)
>
> On Wed, May 24, 2017 at 4:22 AM, Neel Patel <[email protected]> wrote:
>> Hi,
>>
>> After debugging the issue in windows, we came to know that "random port"
>> generation logic in runtime is getting failed if we configured proxy server
>> in windows.
>>
>> Below are the code where we are finding random free port and use with our
>> URL "localhost:<port>". Below code return "0" as port value so application
>> is not able to start and it hangs on splash screen. Here, if we configured
>> proxy server in windows then "bind" method always return false and gives
>> message "Operation not permitted" but when we disable proxy server then
>> below code gives valid random port number.
>>
>> QTcpSocket socket;
>> socket.bind(0, QTcpSocket::ShareAddress);
>> port = socket.localPort();
>>
>> Same happens with Linux OS - when user defined "http_proxy" environment
>> variable and run pgAdmin4 application then above code fails and gives "0" as
>> random port number and application hangs on splash screen.
>>
>>
>> From the below Qt 5.8 released link, we came to know that "random port"
>> generation work well after setting application level proxy.
>> http://blog.qt.io/blog/2017/01/23/qt-5-8-released/
>>
>> QNetworkProxy::setApplicationProxy(QNetworkProxy());
>>
>> After setting above, "bind" method return true and gives correct port number
>> and application starts working. We are also setting
>> "setUseSystemConfiguration=true" after setting application level proxy which
>> will override the setting and use platform specific system proxy
>> configuration.
>>
>> From the below link, it looks like fixed in Qt 5.9.
>> https://bugreports.qt.io/browse/QTBUG-58374
>> https://codereview.qt-project.org/#/c/186124/
>>
>> I have tested with Qt 5.8 Web Engine and webkit in windows. Do review it and
>> let me know for comments.
>>
>> Thanks,
>> Neel Patel
>>
>> On Fri, May 19, 2017 at 4:37 PM, Dave Page <[email protected]> wrote:
>>>
>>> On Thu, May 18, 2017 at 3:42 PM, Neel Patel <[email protected]>
>>> wrote:
>>> > Hi Dave,
>>> >
>>> > Please find attached patch for the fix of RM#2398 - "Proxy not bypassed
>>> > for
>>> > embedded server in runtime on Windows".
>>> >
>>> > Observation:-
>>> > We have observed this issue only with Qt WebEngine. We have not observed
>>> > this issue with Webkit ( Tested with Qt 5.3 ).
>>> >
>>> > Issue:-
>>> > If user set option "Bypass proxy server for local addresses" then
>>> > WebEngine
>>> > doesn't bypass the request for local addresses even if that option is
>>> > set.
>>> >
>>> > Solution:-
>>> > Now if user set option "Bypass proxy server for local addresses" then
>>> > Web
>>> > Engine bypass the request for localhost and if user unset then request
>>> > will
>>> > not be bypassed.
>>> >
>>> > Please find attached fix for this issue. Do review and test it and let
>>> > me
>>> > know for any issue.
>>>
>>> Noted on the ticket:
>>>
>>> ====
>>> Right, but as Maxim has noted, the proxy code is there to allow users
>>> to browse to online docs, so it can't just be disabled.
>>>
>>> This likely worked in 1.3 as that used QtWebEngine (which had a bunch
>>> of other issues). We need to fix it for QtWebKit, so that it honors
>>> the bypass proxy for local addresses option.
>>> ====
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2017-05-30 14:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 14:42 [pgAdmin4][runtime][patch]: RM#2398 - Proxy not bypassed for embedded server in runtime on Windows Neel Patel <[email protected]>
2017-05-19 11:07 ` Dave Page <[email protected]>
2017-05-24 08:22   ` Neel Patel <[email protected]>
2017-05-24 17:53     ` Dave Page <[email protected]>
2017-05-30 14:51       ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox