Post Reply 
Content-Type Issue?
Jun. 22, 2010, 01:53 PM
Post: #16
RE: Content-Type Issue?
(Jun. 22, 2010 01:23 PM)Inferno Wrote:  The web-page filter is matching. I can see the pink matching lines in the log window.

(Jun. 22, 2010 01:23 PM)Inferno Wrote:  Yes I can see it matching 3 times...as it should be.

(Jun. 22, 2010 01:23 PM)Inferno Wrote:  Yes my filter matches 3 times. I can see the pink info in the log window and red <Match: myFilter >City</Match> hints in the HTML debug code.

So problem solved?

If not,
perhaps your filter is adding bad code.

(Jun. 22, 2010 12:56 PM)Inferno Wrote:  If I look into that file, it contains typical json data and escaped html.

Hmmm
Did you test the filter against the escaped html in the test window?
Add Thank You Quote this message in a reply
Jun. 22, 2010, 04:17 PM (This post was last modified: Jun. 22, 2010 05:49 PM by Inferno.)
Post: #17
RE: Content-Type Issue?
The problem is not solved yet. I see very weird results here.
If I turn on the HTML debug info everything matches as it should be (and the colored debug code is displayed in my browser). But if I turn off HTML debug info, the browser wants to download the "update.rq.php" file (save as window pops up) and no content of the file is touched. Please don't get me wrong...the web-page filter is VERY simple, not even using regex. It's just replacing all words that match "City" with "Foo" so the escaped HTML is absolutely no problem. I even copy/pasted the whole content of "update.rq.php" into the filter test form...matches perfectly.

To sum up the situation:
- everything matches well with HTML debug on (matching remark in debug code and log window)
- nothing matches with HTML debug off (no matching remark in log window)

My conclusion: If HTML debug is turned off, proxo "thinks" that I want to download a file or application (update.rq.php) so it does not touch it's contents. Probably proxo is thinking the file is in binary format? (which is not the case)
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:05 PM
Post: #18
RE: Content-Type Issue?
(Jun. 22, 2010 04:17 PM)Inferno Wrote:  If I turn on the HTML debug info everything matches as I should be (and the colored debug code is displayed in my browser). But if I turn off HTML debug info, the browser wants to download the "update.rq.php" file (save as window pops up) and no content of the file is touched.

I am guessing...

With HTML Debug info turned on, the Proxomitron knows that it will be sending the info to the browser for display and makes it happen.

Otherwise, the browser decides what to do. Maybe something about the filtered file causes the browser to request the file again. This re-request is not filtered for some reason other than a application/json content-type header.

Are any of the other filters matching and modifying headers or content?

What kind of site is this?
I already had a filter for this json issue but don't remember why.
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:09 PM
Post: #19
RE: Content-Type Issue?
instead of targeting the "app/json", maybe you could target the "php" file extension instead?
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:22 PM (This post was last modified: Jun. 22, 2010 06:26 PM by sidki3003.)
Post: #20
RE: Content-Type Issue?
(Jun. 22, 2010 04:17 PM)Inferno Wrote:  If I turn on the HTML debug info everything matches as it should be (and the colored debug code is displayed in my browser). But if I turn off HTML debug info, the browser wants to download the "update.rq.php" file (save as window pops up) and no content of the file is touched.

This sounds like an odd but previously discussed Proxomitron quirk about gzipped, filter-forced content-types, aka $TYPE(oth). Proxomitron will decompress - thus filter - them in "dbug.." view only. The work-around is to prevent content-encoding by omitting the outgoing "accept-encoding" header for filter-forced documents.

In sidki-configs >2003 there is a corresponding filter group which is triggered by adding $SET(hRealCT=filter)$FILTER(1) to a user header filter or list entry, but you can implement something similar in all configs, of course.
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:44 PM (This post was last modified: Jun. 22, 2010 06:45 PM by Inferno.)
Post: #21
RE: Content-Type Issue?
(Jun. 22, 2010 06:05 PM)JJoe Wrote:  Are any of the other filters matching and modifying headers or content?
No ALL header and content filters are disabled except for the discussed ones. So I can be sure that all other sources of error are eliminated.

(Jun. 22, 2010 06:05 PM)JJoe Wrote:  What kind of site is this?
It's a normal website which uses much much JavaScript (prototype.js, scriptaculous.js...) and of course AJAX. When I click a button or link, a JavaScript function is called. That function starts a GET request with a query string (lots of parameters) and the server answers with application/json content to fill/update a div box. Therefore only the content of the div container changes without reloading the whole website. This is the common technique for AJAX.

ProxRocks Wrote:instead of targeting the "app/json", maybe you could target the "php" file extension instead?
Good point but does the file extension really matter? I didn't know that proxo ignores/skips specific file extensions? If yes, can you tell me how to force the program to parse "php" files? Smile!
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:51 PM
Post: #22
RE: Content-Type Issue?
(Jun. 22, 2010 06:22 PM)sidki3003 Wrote:  This sounds like an odd but previously discussed Proxomitron quirk about gzipped, filter-forced content-types, aka $TYPE(oth). Proxomitron will decompress - thus filter - them in "dbug.." view only. The work-around is to prevent content-encoding by omitting the outgoing "accept-encoding" header for filter-forced documents.

In sidki-configs >2003 there is a corresponding filter group which is triggered by adding $SET(hRealCT=filter)$FILTER(1) to a user header filter or list entry, but you can implement something similar in all configs, of course.

Now this is embarrassing,
http://tech.groups.yahoo.com/group/prox-...sage/23762 ,
again.

D'oh!

Thanks
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:52 PM (This post was last modified: Jun. 22, 2010 06:53 PM by Inferno.)
Post: #23
RE: Content-Type Issue?
(Jun. 22, 2010 06:22 PM)sidki3003 Wrote:  This sounds like an odd but previously discussed Proxomitron quirk about gzipped, filter-forced content-types, aka $TYPE(oth). Proxomitron will decompress - thus filter - them in "dbug.." view only. The work-around is to prevent content-encoding by omitting the outgoing "accept-encoding" header for filter-forced documents.

In sidki-configs >2003 there is a corresponding filter group which is triggered by adding $SET(hRealCT=filter)$FILTER(1) to a user header filter or list entry, but you can implement something similar in all configs, of course.
Could you explain that in a bit more detail please? Smile!
I found a header filter called "Accept-Encoding: 1 Kill if Filter-Forced 7.03.06 [mona] (d.0) (Out)". Is it the right one? If yes, what do I need to do. As already mentioned, I'm not an expert in things like Proxomitron config like you Thumbs Up
Add Thank You Quote this message in a reply
Jun. 22, 2010, 06:56 PM
Post: #24
RE: Content-Type Issue?
(Jun. 22, 2010 06:51 PM)JJoe Wrote:  Now this is embarrassing,
http://tech.groups.yahoo.com/group/prox-...sage/23762 ,
again.
I'm sorry JJoe but I cannot view this website...need to login there but I've got no yahoo account.
Add Thank You Quote this message in a reply
Jun. 22, 2010, 07:15 PM (This post was last modified: Jun. 22, 2010 07:19 PM by JJoe.)
Post: #25
RE: Content-Type Issue?
(Jun. 22, 2010 06:52 PM)Inferno Wrote:  Could you explain that in a bit more detail please? Smile!

You need to add to one of sidki's lists, Exceptions-U.ptxt.

Open Exceptions-U.ptxt and you should find

Code:
============================================================================
## 4.2  OTHER
## ============================================================================
##
## In this section you can add entries which control filtering directly,
## rather than applying a keyword or flag.
##
## Examples:
##   Force filtering of an RSS feed:
##   prxbx.com/forums/syndication.php*type\=atom $SET(hRealCT=filter)$FILTER(1)

OR

You could set the variable and $FILTER() in a header filter.
Add Thank You Quote this message in a reply
Jun. 22, 2010, 07:26 PM (This post was last modified: Jun. 22, 2010 07:27 PM by Inferno.)
Post: #26
RE: Content-Type Issue?
(Jun. 22, 2010 07:15 PM)JJoe Wrote:  You need to add to one of sidki's lists, Exceptions-U.ptxt.

Strange...I can't find this. Where can I get the file? Smile!
I downloaded the sidki-config "sidki_l_2009-02-13" and the latest update but the file is missing? I guess it would be easier to tell me what to use in the header filter Smile!
Add Thank You Quote this message in a reply
Jun. 22, 2010, 07:36 PM (This post was last modified: Jun. 22, 2010 07:39 PM by Inferno.)
Post: #27
RE: Content-Type Issue?
OK I did a little experiment now...quite interesting...

http://perl.host-ed.net/text-html.cgi
http://perl.host-ed.net/application-json.cgi

I wrote two small CGI scripts which return different Content-Types. The first one returns text/html and the second one application/json.
Now try to replace all words "human" with "alien" with a simple web-page filter.

In the first one all words matching "human" get replaced with "alien" properly, but whats with the second one? Nothing happens...
The browser again wants to download the file, but nothing has been replaced. I hope the situation is clear now Smile!
Add Thank You Quote this message in a reply
Jun. 22, 2010, 07:53 PM
Post: #28
RE: Content-Type Issue?
(Jun. 22, 2010 07:26 PM)Inferno Wrote:  I guess it would be easier to tell me what to use in the header filter Smile!

Sorry.
For that one you need to edit IncludeExclude-U.ptxt.

Code:
## force specified content-type            $SET(hRealCT=IncEx: cont/type)

The header filter would be a little different.

The alpha is at http://prxbx.com/forums/showthread.php?t...3#pid12473
Add Thank You Quote this message in a reply
Jun. 22, 2010, 08:37 PM
Post: #29
RE: Content-Type Issue?
This time the IncludeExclude-U.ptxt is missing. I added the following code to Exceptions-U.ptxt:

Code:
## force specified content-type            $SET(hRealCT=IncEx: cont/type)
## ----------------------------------------------------------------------------
$SET(hRealCT=IncEx: application/json)

Is that right?
Add Thank You Quote this message in a reply
Jun. 22, 2010, 08:51 PM
Post: #30
RE: Content-Type Issue?
(Jun. 22, 2010 07:36 PM)Inferno Wrote:  OK I did a little experiment now...quite interesting...

http://perl.host-ed.net/text-html.cgi
http://perl.host-ed.net/application-json.cgi

I wrote two small CGI scripts which return different Content-Types. The first one returns text/html and the second one application/json.
Now try to replace all words "human" with "alien" with a simple web-page filter.

In the first one all words matching "human" get replaced with "alien" properly, but whats with the second one? Nothing happens...
The browser again wants to download the file, but nothing has been replaced. I hope the situation is clear now Smile!

The browsers that I tested show the download dialog with or without the Proxomitron. Think
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: