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

Image proxy - drops images, fsocket/curl restrictions #5172

Open
sbulen opened this Issue Nov 25, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@sbulen
Contributor

sbulen commented Nov 25, 2018

Description

I just picked 21 random http: images from my forum. With the proxy off, all 21 show. In 2.0, with the proxy ON, 19 show & 2 are dropped. But in 2.1, with the proxy ON, 14 show & 7 are dropped... I see at least 4 different symptoms on the 7 items dropped. ("dropped" means not displayed at all.) I've confirmed this on WAMP & on Linux.

This one is odd, host headers are strange...

This image is not properly cached or displayed in 2.0.15 nor in 2.1.

Steps to reproduce

Test link:
http://www.gitare.info/datas/users/8418-nopickupslespaul.jpg

Environment (complete as necessary)

  • Version/Git revision: today's
  • Database Type: mysql
  • Database Version: 5.7
  • PHP Version: 5.6

Additional information/references

@live627 live627 added this to the RC 2 milestone Nov 25, 2018

@sbulen

This comment has been minimized.

Contributor

sbulen commented Nov 25, 2018

I just noticed that this image works fine on my 2.1 WAMP server, but not on my unix server. There's a clue in there somewhere...

@sbulen

This comment has been minimized.

Contributor

sbulen commented Nov 26, 2018

What is strange about this image is this: the header comes back with an http status of 200... BUT... It returns an https image. So, a redirect is occurring internally, without a 301/302/307 & new location. (You can simply click on the link above & inspect the headers to confirm this...)

image

@jdarwood007

This comment has been minimized.

Member

jdarwood007 commented Nov 27, 2018

Tested and it is sending a proper 301, but does send it in a weird way in which I wonder if the library is misdirecting the hostname.

$ telnet www.gitare.info 80
Trying 188.138.57.50...
Connected to gitare.info.
Escape character is '^]'.
GET http://www.gitare.info/datas/users/8418-nopickupslespaul.jpg
HTTP/1.1 301 Moved Permanently
Date: Tue, 27 Nov 2018 04:39:32 GMT
Server: Apache
Location: https:///datas/users/8418-nopickupslespaul.jpg
Cache-Control: max-age=2592000
Expires: Thu, 27 Dec 2018 04:39:32 GMT
Vary: Accept-Encoding
Content-Length: 254
Connection: close
Content-Type: text/html; charset=iso-8859-1
Set-Cookie: PH_HPXY_CHECK=s1; path=/
Cache-control: private

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https:///datas/users/8418-nopickupslespaul.jpg">here</a>.</p>
</body></html>
Connection closed by foreign host.

A wget shows it properly redirecting.

$ wget http://www.gitare.info/datas/users/8418-nopickupslespaul.jpg
--2018-11-26 20:38:32--  http://www.gitare.info/datas/users/8418-nopickupslespaul.jpg
Resolving www.gitare.info... 188.138.57.50
Connecting to www.gitare.info|188.138.57.50|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.gitare.info/datas/users/8418-nopickupslespaul.jpg [following]
--2018-11-26 20:38:36--  https://www.gitare.info/datas/users/8418-nopickupslespaul.jpg
Connecting to www.gitare.info|188.138.57.50|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 59685 (58K) [image/jpeg]
Saving to: ‘8418-nopickupslespaul.jpg’

8418-nopickupslespaul.jpg                        100%[=========================================================================================================>]  58.29K   378KB/s    in 0.2s

2018-11-26 20:38:37 (378 KB/s) - ‘8418-nopickupslespaul.jpg’ saved [59685/59685]
@sbulen

This comment has been minimized.

Contributor

sbulen commented Nov 27, 2018

Everything looks good on my local WAMP server & matches the above.

My linux server is hosted thru a different provider & has zero luck with that photo. The sockets attempt fails on a connection refused. (This photo only....)

My suspicion is that my host is blacklisted by the provider for that site for fsockets & curl. I've seen similar things before, with different hosts. Usually just a temporary issue until they sort it out.

Image links in posts work, but the image proxy won't work under these circumstances for those photos. So you enable the proxy & the images disappear.

The solution is pretty simple, actually - to treat it the same way we treat files that are too large to cache, just do the redirect.

@sbulen sbulen referenced a pull request that will close this issue Nov 27, 2018

Open

If it cannot be cached, fall back to redirect #5175

@sbulen

This comment has been minimized.

Contributor

sbulen commented Nov 29, 2018

Here's another image with similar behavior. This one fails on both my WAMP & linux servers:
http://www.xs4all.nl/~pekveren/us20/images/us20.gif

@sbulen

This comment has been minimized.

Contributor

sbulen commented Nov 30, 2018

Notes on the above:

  • The photobucket image doesn't exist anymore. Normally photobucket sends you a dummy replacement image telling you so. Those informative replacement images disappear with the proxy enabled.
  • The gitare item only fails on some servers (only one of my two)
  • The other 2 fail on both of my servers

@sbulen sbulen changed the title from Image proxy - drops image, reason really unknown... to Image proxy - drops images, fsocket/curl restrictions Nov 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment