tenox7 / wrp

Web Rendering Proxy: Use vintage, historical, legacy browsers on modern web
Apache License 2.0
1.08k stars 52 forks source link

Not sure how this is supposed to work - bug? #1

Closed DavidCWGA closed 8 years ago

DavidCWGA commented 8 years ago

I've been attempting to get wrp-cocoa.py working on my Mac but I'm having some problems.

Launching it and then loading http://localhost:8080 results in:

./wrp-cocoa.py:99: UninitializedDeallocWarning: leaking an uninitialized object of type NSURL
  nsurl = Foundation.NSURL.alloc().initFileURLWithPath_(url)
2016-07-13 13:45:32.286 Python[3159:73840] <type 'exceptions.NameError'>: global name 'url' is not defined

OK, maybe I need to specify a URL. But loading localhost:8080/http://cnn.com results in:

>>> request for url: /http://cnn.com
./wrp-cocoa.py:99: UninitializedDeallocWarning: leaking an uninitialized object of type NSURL
  nsurl = Foundation.NSURL.alloc().initFileURLWithPath_(url)
2016-07-13 13:46:43.133 Python[3208:75329] <type 'exceptions.NameError'>: global name 'url' is not defined

The URL appears to be prefixed with a /. And then of course it's still complaining that "url" is undefined, here:

nsurl = Foundation.NSURL.alloc().initFileURLWithPath_(url)

Should "url" be "rurl"? Even if you change that, I still can't figure out how to correctly pass a URL that isn't prefixed with a slash.

tenox7 commented 8 years ago

You use this as a HTTP proxy not as a URL. Think of Squid. You need to configure HTTP proxy as described here: https://support.apple.com/kb/PH18553?locale=en_US If you use Firefox instead of Safari you can configure proxy just in Firefox instead of the whole system.

DavidCWGA commented 8 years ago

I'm an idiot. Thanks.

(Can this be a feature request? :)

tenox7 commented 8 years ago

An older version of WRP allowed to be run as a cgi-bin application instead of a proxy. I can probably dig it out.

DavidCWGA commented 8 years ago

Actually I've encountered a new issue:

2016-07-14 00:17:40.790 Python[4753:136361] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
 ... something went wrong 2: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

Apparently the solution is to put this in Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

But python scripts don't have an Info.plist. Is there a workaround that you know of?

tenox7 commented 8 years ago

Can you open a new / separate issue for this?

Perhaps this would work? Maybe an "app" could be created with this:

https://www.metachris.com/2015/11/create-standalone-mac-os-x-applications-with-python-and-py2app/