Skip to content
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

Enhancement: Add PCRE pre-processor of inbound HTML code. #11

Closed
tragicfame opened this issue May 16, 2012 · 3 comments
Closed

Enhancement: Add PCRE pre-processor of inbound HTML code. #11

tragicfame opened this issue May 16, 2012 · 3 comments

Comments

@tragicfame
Copy link

Noticed in your comments that Javascript couldn't be disabled and that location tagging couldn't be disabled either. Perhaps a viable option would be to include PCRE into the mix (currently used in Safari, and may even be able to be used in the API) If you could run the inbound buffer through a series of Perl Regular Expressions to filter out things like script tags and such forth.

@mtigas
Copy link
Member

mtigas commented May 16, 2012

This is a pretty good solution that, I think, would work by hooking a regex search (like you're talking about) in -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data and -(void)connectionDidFinishLoading:(NSURLConnection *)connection (and the duplicated HTTPConnection* versions of those) in ProxyURLProtocol.

Will look into it.

@tragicfame
Copy link
Author

Just a really rough cut off the top of my head to kill off Javascript... Here's two RE's that may help. Granted I didn't test them first.

Catching Events:
/on(afterprint|beforeprint|beforeonload|blur|error|focus|haschange|load|message|offline|online|pagehide|pageshow|popstate|redo|resize|storage|undo|unload|blur|change|contextmenu|focus|formchange|forminput|input|invalid|reset|select|submit|keydown|keypress|keyup|click|dblclick|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|mousedown|mousemove|mouseout|mouseover|mouseup|mousewheel|scroll|abort|canplay|canplaythrough|durationchange|emptied|ended|loadeddata|loadedmetadata|loadstart|pause|play|playing|progress|ratechange|readystatechange|seeked|seeking|stalled|suspend|timeupdate|volumechange|waiting)=("|/')[^(\"|/')]+("|/')//gi

Catching Scripts:
s/<script.*(/>|/script>)//gi

@mtigas
Copy link
Member

mtigas commented Feb 1, 2014

fixed/superseded by the script-blocking patch in b634ef8

@mtigas mtigas closed this as completed Feb 1, 2014
mtigas pushed a commit that referenced this issue Feb 14, 2017
Apparently on iPad where a hardware keyboard is used, these values
will both be the same so this is a way to detect if there is a
software keyboard up or not.  http://stackoverflow.com/a/16765270

Needs a test with a bluetooth keyboard, which I do not have.

Ref #11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants