Post Reply 
Wish to make a URL header filter work with https and http (Sidki's set)
May. 04, 2013, 08:16 AM
Post: #1
Wish to make a URL header filter work with https and http (Sidki's set)
Here is a filter that takes a youtube URL and converts it so that the video is isolated in your browser:
Code:
[HTTP headers]
In = FALSE
Out = TRUE
Key = "!-|||||||||||| URL: Youtube Video Direct (out)"
URL = "((www.|m.|)youtube.com/)((watch*v=|embed/|v/)(?+{11})\1)$JUMP(http://youtube.googleapis.com/v/\1)"

I would like to make the filter work with http and https connections but haven't a clue as to what to do. I expect it has something to do with the uProt variable (Sidki's set).

Here are 5 second test URLs (Bugs Bunny - What a maroon):
http://www.youtube.com/watch?v=C_Kh7nLplWo
https://www.youtube.com/watch?v=C_Kh7nLplWo
Add Thank You Quote this message in a reply
May. 04, 2013, 03:37 PM
Post: #2
RE: Wish to make a URL header filter work with https and http (Sidki's set)
Try these

Code:
[HTTP headers]
In = FALSE
Out = TRUE
Key = "!-|||||||||||| URL: Youtube Video Direct [add](out)"
URL = "(www.|m.|https*.$SET(2=https-px-.)|)youtube.com[^/]+/((watch*v=|embed/|v/)(?+{11})\1)$JUMP($GET(uProt)//\2youtube.googleapis.com/v/\1)"

Lots of certificate warnings from the Proxomitron due to the 'strange' certificate.

To avoid the Proxomitron's warnings

Code:
[HTTP headers]
In = FALSE
Out = TRUE
Key = "!-|||||||||||| URL: Youtube Video Direct always http [add](out)"
URL = "(www.|m.|https*.|)youtube.com[^/]+/((watch*v=|embed/|v/)(?+{11})\1)$JUMP(http://youtube.googleapis.com/v/\1)"

but the browser might warn about https changing to http.

HTH
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to JJoe for this post:
dave
May. 05, 2013, 01:26 AM
Post: #3
RE: Wish to make a URL header filter work with https and http (Sidki's set)
Thanks JJoe. The second filter is just what I wanted. I should have made it clear that I wanted the output to be http. I had no idea that you could directly match the protocol expression (https) in the match. I thought you had to set a variable or something like that.

But I have a question as I'm not understanding the matching expressions in your filter.

At the end of 'youtube.com' is the expression '[^/]+/' and I see it's critical as I tried the filter without that and it did not work when used with the https protocol. I think it did work with the http protocol. I don't believe that expression is ever going to match because I think 'youtube.com' is always immediately followed by a forward slash (/). So I wonder what is the purpose of matching anything but the forward slash when it seems to me that expression will never match.

So I am confused and would like an explanation if possible and if I've made myself clear. Thanks.
Add Thank You Quote this message in a reply
May. 05, 2013, 02:11 AM
Post: #4
RE: Wish to make a URL header filter work with https and http (Sidki's set)
(May. 05, 2013 01:26 AM)dave Wrote:  At the end of 'youtube.com' is the expression '[^/]+/' and I see it's critical as I tried the filter without that and it did not work when used with the https protocol.

The browser shows you
https://www.youtube.com/watch?v=C_Kh7nLplWo ....... but the Proxomitron sees
https://www.youtube.com:443/watch?v=C_Kh7nLplWo

[^/]+ matches :443 or nothing, which covers both http and https
+ says match all or none.

HTH
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to JJoe for this post:
dave
May. 05, 2013, 02:40 AM
Post: #5
RE: Wish to make a URL header filter work with https and http (Sidki's set)
I understand now but am perplexed as to how I could have known this because the ':443' does not show up in my log window. Is this in Prox's documentation? Or perhaps it's how the browser also sees it even though the address bar does not reflect it. Would I have needed to use another app like TCP View?

Thanks.
Add Thank You Quote this message in a reply
May. 05, 2013, 04:42 AM
Post: #6
RE: Wish to make a URL header filter work with https and http (Sidki's set)
(May. 05, 2013 02:40 AM)dave Wrote:  I understand now but am perplexed as to how I could have known this because the ':443' does not show up in my log window. ...... Would I have needed to use another app like TCP View?

:443 does sometimes show in the log window. Especially while the Proxomiton is sending to another proxy.
You might also see :443 in http://local.ptron/.pinfo/urls/

And we can always ask Proxo

Code:
[HTTP headers]
In = FALSE
Out = TRUE
Key = "! : what proxo sees"
URL = "$LOG(R\u)(^)"

(May. 05, 2013 02:40 AM)dave Wrote:  Is this in Prox's documentation?

I don't think it is in the Proxomitron's documentation.

(May. 05, 2013 02:40 AM)dave Wrote:  Or perhaps it's how the browser also sees it even though the address bar does not reflect it.

I can't find the resource that explained this. It could be dated anyway.
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to JJoe for this post:
dave
May. 05, 2013, 05:49 AM (This post was last modified: May. 05, 2013 05:58 AM by dave.)
Post: #7
RE: Wish to make a URL header filter work with https and http (Sidki's set)
Yep, there it is when forwarding to another proxy:
Code:
+++GET 1941+++
Using Proxy - xxxx:xxxx
CONNECT https://www.youtube.com:443/ HTTP/1.0

And the filter is very nice as it shows each url proxo sees.

Thanks again JJoe
Add Thank You Quote this message in a reply
May. 06, 2013, 09:59 PM
Post: #8
RE: Wish to make a URL header filter work with https and http (Sidki's set)
(May. 04, 2013 03:37 PM)JJoe Wrote:  youtube.com[^/]+/

is there any chance this would also match
Quote:youtube.com.someothersite.com/
youtube.comic.bla.com/
?
Add Thank You Quote this message in a reply
May. 07, 2013, 12:16 AM
Post: #9
RE: Wish to make a URL header filter work with https and http (Sidki's set)
(May. 06, 2013 09:59 PM)neverwasinparis Wrote:  is there any chance this would also match

Absolutely. It is possible that there is a url out there that will cause this filter to show Dave an unexpected page from youtube.googleapis.com/v/. It just seemed unlikely to happen and likely harmless if it did. You don't always want to do it this way.

I tend to prefer + to (something|).
Add Thank You Quote this message in a reply
May. 07, 2013, 12:44 AM
Post: #10
RE: Wish to make a URL header filter work with https and http (Sidki's set)
the probability is low. but anyway
Code:
youtube.com(:[0-9]+|)/

works.
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: