Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Extension doesn't work behind an autoconfigured web proxy #22

Open
EnzephaloN opened this issue Nov 7, 2017 · 22 comments · Fixed by #170
Open

[BUG] Extension doesn't work behind an autoconfigured web proxy #22

EnzephaloN opened this issue Nov 7, 2017 · 22 comments · Fixed by #170
Labels

Comments

@EnzephaloN
Copy link

EnzephaloN commented Nov 7, 2017

Hello
I'm behind a proxy (with authentication).
In Debian I set all the proxy-stuff and also "org.gnome"-proxy-settings are set.
But I get "A network error occured: 2" as message.
How can I add proxy-informations to the script?

regards
Johannes

@neffo
Copy link
Owner

neffo commented Nov 8, 2017

Hi Johannes, we don't currently handle that case at all. We use Soup to fetch the json & images, so it shouldn't be impossible to implement.

If you are aware of a GNOME extension that has a working implementation that you'd recommend can you let me know? I don't have a way to test this, so it could be a pain to build something from scratch.

@neffo
Copy link
Owner

neffo commented Nov 8, 2017

We use the Soup proxy resolver, which seems like it should use the GNOME settings. Can you tell me what errors you are seeing with journalctl?

@EnzephaloN
Copy link
Author

Hello neffo
Like I sad, I had configured our proxy in GNOME. But this doesn't help. Everytime I got "network error 2". After some playing I deinstalled your Plugin, so I'm not able to give you more informations.

@neffo
Copy link
Owner

neffo commented Nov 9, 2017

No problem, thanks for submitting the ticket though.

The error seems to be this one:
{ SOUP_STATUS_CANT_RESOLVE_PROXY, "Cannot resolve proxy hostname" },

That suggests the proxy autodetection is either ignoring the GNOME settings or it's unable to use the proxy to look up hostnames? Ugh.

@kejml
Copy link

kejml commented May 10, 2022

I also sit behind a corporate proxy and fetching the images doesn't work for me. but with a different error:

May 10 10:22:13 pc9d061 gnome-shell[3769]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=
May 10 10:22:13 pc9d061 gnome-shell[3769]: BingWallpaper extension: Network error occured: 4

If I could somehow help with debugging, I'm open to doing so - I'm also a developer, but I have zero experience with Gnome extension development, so I might need some guidance.

In my case, the proxy is without authentication, and I use Ubuntu 20.04 with Gnome 3.36.8

@neffo neffo changed the title behind a proxy? Extension doesn't work behind a web proxy May 10, 2022
@neffo neffo mentioned this issue May 10, 2022
5 tasks
@neffo neffo linked a pull request May 10, 2022 that will close this issue
5 tasks
@neffo
Copy link
Owner

neffo commented May 10, 2022

This is a long standing bug, which I don't have a direct way to test. If you are able to checkout version-41 branch of this repo, you could test if this simple fix corrects it #170 . My understanding is that this proxy resolver should already be enabled by default, but that is based on documentation alone (not tested).

@kejml
Copy link

kejml commented May 10, 2022

I tried uninstalling version from gnome extension page using gnome extensions app, installing version from the branch using included install.sh, then I logged out in Gnome and logged back in, but the result for me is, unfortunately, the same:

May 10 13:30:05 pc9d061 gnome-shell[1401521]: BingWallpaper extension: next check in 86400 seconds @ local time 2022-05-11 13:30 +0200
May 10 13:30:05 pc9d061 gnome-shell[1401521]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=
May 10 13:30:05 pc9d061 gnome-shell[1401521]: BingWallpaper extension: Network error occured: 4
May 10 13:30:05 pc9d061 gnome-shell[1401521]: BingWallpaper extension: next check in 3600 seconds @ local time 2022-05-10 14:30 +0200

PS: In the about tab in settings, I still see version 40, but I guess, based on the diff of #170 it is correct, right?

@neffo
Copy link
Owner

neffo commented May 10, 2022

Thanks for helping debug this.

Ok just pushed a new commit which will dump Soup headers, if you want to enable debug logging it should hopefully output something like this:

May 10 22:59:28 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: GET /HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt= HTTP/1.1
May 10 22:59:28 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1652187568
May 10 22:59:28 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: Soup-Debug: SoupSession 1 (0x55bc0bd23460), SoupMessage 1 (0x55bc0ff0e2c0), SoupSocket 1 (0x55bc0d393eb0)
May 10 22:59:28 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: Host: www.bing.com

@kejml
Copy link

kejml commented May 10, 2022

May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: next check in 86400 seconds @ local time 2022-05-11 15:49 +0200
May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=
May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: Soup: HTTP/1.1 4 Could not connect: Network is unreachable
May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1652190548
May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: Soup: Soup-Debug: SoupMessage 0 (0x558778f5b580)
May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: Network error occured: 4
May 10 15:49:08 pc9d061 gnome-shell[1501388]: BingWallpaper extension: next check in 3600 seconds @ local time 2022-05-10 16:49 +0200

Of course, internet connection works perfectly fine for other apps at the same moment (using that corporate proxy)

@neffo
Copy link
Owner

neffo commented May 10, 2022

Doesn't seem to be using proxy at all, no.

However, if I set my proxy to 'test:8080' (not a real host) in GNOME settings I get this:

May 11 00:39:07 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=
May 11 00:39:07 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: HTTP/1.1 2 Error resolving “test”: Temporary failure in name resolution
May 11 00:39:07 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1652193547
May 11 00:39:07 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Soup: Soup-Debug: SoupMessage 0 (0x55bc0ff0e4a0)
May 11 00:39:07 ubuntu-desktop-22 gnome-shell[42952]: BingWallpaper extension: Network error occured: 2

This suggests the proxy detection is doing something for me. I suspect your proxy is set up a bit different however. Does wget work for that link above?

Update: Looks like the detection of proxies might be a bit timing related. We're currently using a persistent session, but the detection seems to a one time thing as a result (which might be a problem if the proxy changes). Perhaps we could cycle the session if the GNOME system proxy changes?

@kejml
Copy link

kejml commented May 10, 2022

Aha, when I set proxy mode to "manual" in Gnome, then the download works!

But for general usage, I need to use the automatic mode, so the system downloads pac file with some more complex rules from our proxy server and that obviously doesn't work with the extension

@neffo
Copy link
Owner

neffo commented May 10, 2022

Right, ok so as I suspected it might be timing related. This might need some reworking. This is technically possible if there is a signal (such as dconf key changing) when the pac file is downloaded we can restart the session to handle the changes. (Or it could be that it doesn't work with pac file proxy settings, which would be annoying.)

Possible this key would work:
org.gnome.system.proxy

@neffo neffo changed the title Extension doesn't work behind a web proxy Extension doesn't work behind an autoconfigured web proxy May 10, 2022
@neffo
Copy link
Owner

neffo commented May 11, 2022

Ok, I have just committed a change that will create a new Soup session on refresh. It's possible the proxy settings are fixed by creating a session at startup. Creating a new one each refresh might solve a (possible) timing issue.

@kejml
Copy link

kejml commented May 11, 2022

Thanks, I'll test it next week, when I'm in the office again and I'll let you know

@neffo neffo changed the title Extension doesn't work behind an autoconfigured web proxy [BUG] Extension doesn't work behind an autoconfigured web proxy Jun 4, 2022
@neffo
Copy link
Owner

neffo commented Jun 8, 2022

Any word on if this helped with this issue?

@kejml
Copy link

kejml commented Jun 8, 2022

Oh, sorry, I completely forgot and I was in the office yesterday.... I'll put a reminder to my calendar for a next week

@neffo
Copy link
Owner

neffo commented Jun 10, 2022

Ok I've been testing this locally and for some reason libsoup (or at least the way I'm using it) doesn't acknowledge auto configured proxies (even with changes I've made). It's not timing related (as I suspected above), so nothing will have changed. It's like the proxy resolver is not picking up any proxy at all, even with a very simple .PAC file:

Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=en-GB
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: GET /HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=en-GB HTTP/1.1
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1654868639
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug: SoupSession 1 (0x562dc6bc87c0), SoupMessage 1 (0x562dc6181770), SoupSocket 1 (0x562dbfb30b90)
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Host: www.bing.com
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Accept-Encoding: gzip, deflate
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Connection: Keep-Alive
Jun 10 23:43:59 fedora gnome-shell[2004]: BingWallpaper extension: Soup: HTTP/1.1 200 OK

Using manual proxy works just fine (so confirming what you said):

Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=en-GB
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: CONNECT www.bing.com:443 HTTP/1.1
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1654868774
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug: SoupSession 1 (0x562dc22d6340), SoupMessage 1 (0x562dbf518aa0), SoupSocket 1 (0x562dbfb30c60)
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Host: www.bing.com
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Accept-Encoding: gzip, deflate
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Connection: Keep-Alive
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: HTTP/1.0 200 Connection established
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1654868774
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug: SoupMessage 1 (0x562dbf518aa0)
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Proxy-agent: tinyproxy/1.8.4
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: GET /HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=en-GB HTTP/1.1
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1654868774
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Soup-Debug: SoupSession 1 (0x562dc22d6340), SoupMessage 2 (0x562dbe671e70), SoupSocket 1 (0x562dbfb30c60)
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Host: www.bing.com
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Accept-Encoding: gzip, deflate
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: Connection: Keep-Alive
Jun 10 23:46:14 fedora gnome-shell[2004]: BingWallpaper extension: Soup: HTTP/1.1 200 OK

neffo added a commit that referenced this issue Jun 10, 2022
@kejml
Copy link

kejml commented Jun 14, 2022

Just to confirm your observation, even the latest commits from the version-41 branch didn't help:

Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: next check in 86400 seconds @ local time 2022-06-15 10:58 +0200
Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: fetching: https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8&mbl=1&mkt=
Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: Soup: HTTP/1.1 4 Could not connect: Network is unreachable
Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: Soup: Soup-Debug-Timestamp: 1655197130
Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: Soup: Soup-Debug: SoupMessage 0 (0x55ec7415a1c0)
Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: Network error occured: 4
Jun 14 10:58:50 pc9d061 gnome-shell[587705]: BingWallpaper extension: next check in 3600 seconds @ local time 2022-06-14 11:58 +0200

@neffo
Copy link
Owner

neffo commented Jun 14, 2022

Thanks for confirming (means my testing approach was useful), I've actually had a lot of trouble tracking this one down. I'm not sure libsoup actually knows what to do with .pac files. It seems to use a simple proxy lookup that appears to just look at protocols (aka the http/https/socks part of the url). I might raise a ticket upstream. An alternative, hacky method would be to manually set a proxy host within the extension but that doesn't seem the 'right' way to do it.

@kejml
Copy link

kejml commented Jun 14, 2022

Personally, I would raise the ticket in the lib. This ticket is open for more than 4 years without getting too much attention, so I don't think it's worth implementing some hacky solution on your side.

@kejml
Copy link

kejml commented Aug 25, 2022

@neffo Did you close this one on purpose? I guess you'll just wait for a fix in the library, right?

@neffo neffo reopened this Aug 25, 2022
@neffo
Copy link
Owner

neffo commented Aug 25, 2022

Yep, was closed automatically. Reopened, pending a miracle (or a work around).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants