#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    2
    Rep Power
    0

    Question CGI with Python (on proxy with HTTPS)


    Hello there

    I have been trying to write a Python script which would access a CGI script
    on a https server behind a proxy, and I am getting nowhere.

    First, the setup:
    There is a proxy, where you get when entering an URL like (domainnames
    changed):
    https://www.myproxy.com/
    (no login required)

    The server I'd like to access is:
    www.myproxy.com/server/
    resp. the cgi script
    www.myproxy.com/server/cgi-gin/server.py
    (login required for both)

    To access this server I wrote a script called query.py:

    a) using urllib.urlopen('www.myproxy.com/server/cgi-gin/server.py'):
    urlopen asks me for a username and a password and I can read the output of the cgi script. The problem is: I can not POST any arguments within this urlopen command (I usually have several fields and upload files as arguments, using cgi.FieldStorage() containing fields with 3 entries (name, filename, content of file)).

    b) using urllib2.urlopen and ProxyHandler and HTTPBasicAuthHandler:
    apart from the fact, that I don't really know what I am doing, it doesn't work.

    c) using httplib.HTTP(host):
    this worked perfectly, as long as the cgi was on a http server. When changing to https, the script doesn't work anymore (even if using httplib.HTTPS()).


    Is there an easy way of doing this? I would prefer something like a) with a
    working POST, or a c) with a login prompt like in a).

    Thanks for any help.

    Bruno
    Last edited by nyffeler; April 22nd, 2004 at 04:48 AM.

IMN logo majestic logo threadwatch logo seochat tools logo