The Un-Official Proxomitron Forum

Full Version: Forum button images Local storage (Doom9.org)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I posted one of those for the old and buried proxo forum also, perhaps some of them still has them.

First of all, I'm a newbie, and I probably will for ever, no matter how hard I try, I'll stay a newbie regarding regular expressions and website stuff overall.

The idea of this filter and its accompanied forum images is to take some stress from websites you have problems with, due to slow responses/high forum activity/slow ping times.

I just started for a forum I regularly visit for media en-/decoding, called doom9.org. I started creating a local cache for the forum buttons because requesting images for changes took a long time, and ultimately the browser had them in cache most of the time, but anyway.


I created a little filter which took care of (most of) the forum buttons, smillies, anything image related. Thus the browser still sends requests to the forum if images got changed, but proxomitron now takes the work and sends back a locally cached image instead of send the requests to the forum server.

If I have a little time, and if it would be a good idea (correct me if I'm wrong, but perhaps my filter has drawbacks which I newbishly didn't think about) to make one for this forum also.

Here's the code :
Code:
[Blocklists]
List.Doom9 = "..\Doom9\Doom9.txt"

[HTTP headers]
In = FALSE
Out = TRUE
Key = "! : Redir: Doom9 images cache TEST (out)"
URL = "forum.doom9.org/images/(statusicon|misc|buttons|smilies|attach|editor)/(*.(gif|png))\1&$LST(Doom9)$RDIR(http://local.ptron/Doom9/\1)"

... and the local image cache (to extract in main proxo folder, images are in subdirs)

EDIT: replace double / by single one in $RDIR command.
(Dec. 20, 2009 09:56 PM)Toppy Wrote: [ -> ]local.ptron//Doom9

Is there an extra "/" ?
(Dec. 21, 2009 03:13 AM)JJoe Wrote: [ -> ]
(Dec. 20, 2009 09:56 PM)Toppy Wrote: [ -> ]local.ptron//Doom9

Is there an extra "/" ?

I JJoe,

Yes, I remember I got everything working fine with a single / , but then all of a sudden (after a system restart) I was getting no images at all, when I tried to access the file directly in the browser by browsing to http://local.ptron/Doom9/bold.gif I got a Proxo response that it could not find the file (1 day earlier it all worked fine Suspicious ), after some digging and testing I found that using 2 //'s it worked again.

So actually, I'm stumbled why it doesn't work anymore with 1 / now.

You get it working on your system with 1 / ?

EDIT: Yep, it works fine again with 1 / ... I'm stumped about why it didn't work yesterday ? SuspiciousSuspicious
I've edited the top post.

JJoe, could the placement in the .cfg file (with Sidki's filters) have an effect on it, it looks like a single / works fine if you lets Proxo handle the placement of the filter in the default.cfg file, on my system, a single / doesn't seem to work if the filter is placed at the bottom of the [HTTP Headers] section of the default.cfg (right before the [Patterns]...
(Dec. 22, 2009 01:37 PM)Toppy Wrote: [ -> ]You get it working on your system with 1 / ?

It works for me with three and probably more.
Number doesn't seem to matter.
I don't think I knew this.

(Dec. 22, 2009 01:37 PM)Toppy Wrote: [ -> ]JJoe, could the placement in the .cfg file (with Sidki's filters) have an effect on it, it looks like a single / works fine if you lets Proxo handle the placement of the filter in the default.cfg file, on my system, a single / doesn't seem to work if the filter is placed at the bottom of the [HTTP Headers] section of the default.cfg (right before the [Patterns]...

Also doesn't matter, win98se.
Sorry to bother you once again Joe,
but knowing that you're one of the Proxo experts here,
perhaps you could make it faster or more accurate or more ..... ,
did I construction the URL = "..." the way it should, or could you make some corrections ?

Would someone be interested if I made one for this forum, as for me it's more some time wasting lol, but perhaps some people would also use it because of faster loading times, and destressing the server ?

Thanks for the help.Wink
(Dec. 22, 2009 08:22 PM)Toppy Wrote: [ -> ]perhaps you could make it faster or more accurate or more ..... ,
did I construction the URL = "..." the way it should, or could you make some corrections ?

I don't see anything that needs to be fixed. Smile!

Is there something that worries you?

I usually try to mirror the site's file structure but it's not necessary.

(Dec. 22, 2009 08:22 PM)Toppy Wrote: [ -> ]Sorry to bother you once again

Wouldn't be much of a forum without questions and answers.

Have fun
Hello there,

In my urge to storage as much as possible locally, I always encounter problems with pages not being rendered properly when storing *.php files locally.

I don't what's wrong, the file is being fetched correctly from local disk, but the browser (FF 3.6) does not seem to apply the stylesheets.

I would really like to store these locally too, since it takes a full 14 seconds to get a reply from the server.

.php file in question is : http://resource.dopus.com/style.php?id=1...on_id_here

I have the correct filter :
Code:
In = FALSE
Out = TRUE
Key = "! : Redir: Dopus Forum images cache TEST (out)"
URL = "resource.dopus.com/(images/(icons/misc/|icons/smile/|smilies/|)|(styles/prosilver/(imageset/(en/|)|theme/(images/|)|template/))|)\1(*.(gif|png|css|js|php))\2&$LST(Dopus)$RDIR(http://local.ptron/Dopus/\1\2)"
... the correct entry in my list : resource.dopus.com/style.php

... and the correct file locally : Path_To_Proxomitron\html\Dopus\style.php


Does anyone know why it doesn't want to work please ?

Thanks a lot.
Seems to be a browser issue. I tested your filter under IE8 and it did work.

Then I made a web filter to do the replacement. IE8 still worked while FF3.6 still didn't work.

I don't know why. D'oh!
(Mar. 15, 2010 02:14 AM)whenever Wrote: [ -> ]Seems to be a browser issue. I tested your filter under IE8 and it did work.

Then I made a web filter to do the replacement. IE8 still worked while FF3.6 still didn't work.

I don't know why. D'oh!
Not working on Opera 10.50 either.
Works on IE8.
Weird....
For a local php file the Proxomitron returns

Code:
HTTP/1.1 200 Local file
Date: Mon, 15 Mar 2010 02:54:14 GMT
Server: Proxomitron
Connection: close
Last-Modified: Mon, 15 Mar 2010 07:32:49 GMT
Content-Length: 69972
Content-type: text/plain

The content-type is "text/plain" not "text/css".
Firefox uses the "text/plain" content-type and breaks the page.
IE uses the file as a css file.

The fix would be to either change the content-type to "text/css"
or the file's extension to "css".

I think.

HTH
(Mar. 15, 2010 03:31 AM)JJoe Wrote: [ -> ]The fix would be to either change the content-type to "text/css"
or the file's extension to "css".

I think.
Just made a test. Both ways worked! Applause
(Mar. 15, 2010 03:31 AM)JJoe Wrote: [ -> ]The content-type is "text/plain" not "text/css".
Firefox uses the "text/plain" content-type and breaks the page.
IE uses the file as a css file.

The fix would be to either change the content-type to "text/css"
or the file's extension to "css".

I think.

HTH
Great !

Sorry for being a newbie, but is there any way to change the header filter above so that it will send the content-type as "text/css" when a .php file is being redirected ?

Thank you so much in advance.Smile!

EDIT: I tried changing the filter so that it reads :

resource.dopus.com/(images/(icons/misc/|icons/smile/|smilies/|)|(styles/prosilver/(imageset/(en/|)|theme/(images/|)|template/))|)\1(*.(gif|png|css|js|php$OHDR(content-type:text/css)))\2&$LST(Dopus)$RDIR(http://local.ptron/Dopus/\1\2)

... but that doesn't seem to work.
You need a new filter to do the job. Something like this:

Code:
[HTTP headers]
In = TRUE
Out = FALSE
Key = "Content-Type: Dopus Test (In)"
URL = "local.ptron/Dopus/style.php"
Match = "text/plain"
Replace = "text/css"
Just think that a better way in this case is to store style.php as style.css, then modify the entry in the $LST(Dopus) as:

Code:
resource.dopus.com/style.php    $SET(2=style.css)

This way you don't need a new filter neither do you need to maintain a local.ptron blockfile.
(Mar. 15, 2010 02:20 PM)whenever Wrote: [ -> ]Just think that a better way in this case is to store style.php as style.css, then modify the entry in the $LST(Dopus) as:

Code:
resource.dopus.com/style.php    $SET(2=style.css)

This way you don't need a new filter neither do you need to maintain a local.ptron blockfile.

Fantastic !
Now i can use this method for the other sites, decreasing the bunch of redundant header filters. Thanks a bunch whenever.Smile!
Reference URL's