Bitcoin Forum

Other => Meta => Topic started by: Mellnik on February 04, 2015, 08:15:28 AM



Title: How does the image proxy work?
Post by: Mellnik on February 04, 2015, 08:15:28 AM
Hey, does anyone know how ip.bitcointalk.org knows if a specific image has been posted on bitcointalk.org?

Since putting random image urls to the proxy fails.


Title: Re: How does the image proxy work?
Post by: escrow.ms on February 04, 2015, 08:19:57 AM
If the image url contains a valid image extension ie: jpg,png,gif etc, image proxy will work otherwise it won't.

For example:

Test
Code:
[img]http://imgur.com/YbpEcb0[/img]
http://imgur.com/YbpEcb0

Code:
[img]https://i.imgur.com/YbpEcb0.png[/img]
https://i.imgur.com/YbpEcb0.png



Title: Re: How does the image proxy work?
Post by: Mellnik on February 04, 2015, 10:20:30 AM
OMG! -,- Put any random picture and you will see it won't work.

https://ip.bitcointalk.org/?u=https://i.imgur.com/O41Y9Du.png (https://ip.bitcointalk.org/?u=https://i.imgur.com/O41Y9Du.png)


https://ip.bitcointalk.org/?u=https://i.imgur.com/YbpEcb0.png (https://ip.bitcointalk.org/?u=https://i.imgur.com/YbpEcb0.png)


Title: Re: How does the image proxy work?
Post by: Muhammed Zakir on February 04, 2015, 11:55:26 AM
Hey, does anyone know how ip.bitcointalk.org knows if a specific image has been posted on bitcointalk.org?

Since putting random image urls to the proxy fails.

This is one of the reason:
If the image url contains a valid image extension ie: jpg,png,gif etc, image proxy will work otherwise it won't.

and the other might be:

Quote from: KnightKrawler @ reddit.com/comments/c68if/what_is_the_difference_between_iimgur_and_imgur
The i.imgur link points directly to the image whereas the imgur.com link goes to the imgur page that also shows the picture and the bandwidth and other pictures.
Any imgur link can be replaced with i.imgur and you'll see the picture with no other info.

The above is about imgur.com but I think you can understand what it means. Just don't look at the website link or name.

OMG! -,- Put any random picture and you will see it won't work.

https://ip.bitcointalk.org/?u=https://i.imgur.com/O41Y9Du.png (https://ip.bitcointalk.org/?u=https://i.imgur.com/O41Y9Du.png)


https://ip.bitcointalk.org/?u=https://i.imgur.com/YbpEcb0.png (https://ip.bitcointalk.org/?u=https://i.imgur.com/YbpEcb0.png)

Ah my bad sorry, I guess image proxy is not working for new images since January. Old images are working because they are cached by the proxy.


Actually, the both links posted above is working for me.


Title: Re: How does the image proxy work?
Post by: dogie on February 04, 2015, 12:05:28 PM
I thought that the post proxy image links do not work if you put them back through the proxy. Let me test now. By the way, imgur links bypass the proxy altogether.

http://cdn.images.express.co.uk/img/dynamic/1/590x/Dog-handler-431049.jpg

Then editing post and putting the proxied image back through:

https://ip.bitcointalk.org/?u=http%3A%2F%2Fcdn.images.express.co.uk%2Fimg%2Fdynamic%2F1%2F590x%2FDog-handler-431049.jpg&t=549&c=fnsjPOVuf7KyWA

Yep. So you can't address the images directly on the proxy already. I'm not sure if that was the question or we'd already established that but there you go :P


Title: Re: How does the image proxy work?
Post by: Mellnik on February 04, 2015, 03:59:55 PM
Not only 1 reply which answers my question.


Title: Re: How does the image proxy work?
Post by: theymos on February 04, 2015, 09:29:58 PM
A proper image proxy link looks like:
https://ip.bitcointalk.org/?u=http%3A%2F%2Fcdn.images.express.co.uk%2Fimg%2Fdynamic%2F1%2F590x%2FDog-handler-431049.jpg&t=549&c=fnsjPOVuf7KyWA

Notice that it has "t" and "c" parameters. These are used to check that the link was generated by the forum. Link generation is done whenever posts are loaded (at the bbcode parsing stage). So the links change over time. (Image proxy links expire after a month or two, so you can't just generate a valid link and then use it forever.)


Title: Re: How does the image proxy work?
Post by: dogie on February 04, 2015, 11:10:37 PM
A proper image proxy link looks like:
https://ip.bitcointalk.org/?u=http%3A%2F%2Fcdn.images.express.co.uk%2Fimg%2Fdynamic%2F1%2F590x%2FDog-handler-431049.jpg&t=549&c=fnsjPOVuf7KyWA

Notice that it has "t" and "c" parameters. These are used to check that the link was generated by the forum. Link generation is done whenever posts are loaded (at the bbcode parsing stage). So the links change over time. (Image proxy links expire after a month or two, so you can't just generate a valid link and then use it forever.)

While we have you, how does the proxy know if the source image has changed content, even if its at the same URL as before? Would it take ~ a month in order to refresh or is there another check that happens?


Title: Re: How does the image proxy work?
Post by: theymos on February 04, 2015, 11:31:25 PM
While we have you, how does the proxy know if the source image has changed content, even if its at the same URL as before? Would it take ~ a month in order to refresh or is there another check that happens?

There is no caching on the bitcointalk.org side. The image is always passed directly from the source server to the user. Any Expires or Cache-Control headers sent by the origin server are passed through as well, so caching might be done by the client.

The code is computed from the URL, not the image data.


Title: Re: How does the image proxy work?
Post by: dogie on February 04, 2015, 11:43:23 PM
While we have you, how does the proxy know if the source image has changed content, even if its at the same URL as before? Would it take ~ a month in order to refresh or is there another check that happens?

There is no caching on the bitcointalk.org side. The image is always passed directly from the source server to the user. Any Expires or Cache-Control headers sent by the origin server are passed through as well, so caching might be done by the client.

The code is computed from the URL, not the image data.

Thanks.

Can we also whitelist flickr? Images always fall on one of the below:

https://farm1.staticflickr.com
https://farm2.staticflickr.com
https://farm3.staticflickr.com
https://farm4.staticflickr.com
https://farm5.staticflickr.com
https://farm6.staticflickr.com
https://farm7.staticflickr.com
https://farm8.staticflickr.com
https://farm9.staticflickr.com
https://farm10.staticflickr.com


Title: Re: How does the image proxy work?
Post by: Mellnik on February 05, 2015, 06:56:36 AM
Thank's theymos for clarifying this!