×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    HTTPS - possible in pys60 ?

    I need to implement a save HTTPS-connection to a server.

    Does anyone can give an excample on how to establish a HTTPS-connection? I found this posting from madsbjoern which does not sound very optimistic.

    Is https working at all on pys60?

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: HTTPS - possible in pys60 ?

    Quote Originally Posted by novis View Post
    I need to implement a save HTTPS-connection to a server.

    Does anyone can give an excample on how to establish a HTTPS-connection? I found this posting from madsbjoern which does not sound very optimistic.

    Is https working at all on pys60?
    hi novis
    check at this page
    hope this helps you.
    give a feedback

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    Re: HTTPS - possible in pys60 ?

    Hi gaba88,
    thx for replying. The excample on the side is for HTTP. I use HTTP-connections to download files for a while now without any problems.

    At the current state I plan to implement the same in HTTPS.
    I'd like to test an HTTPS-connection now and was a bit "shocked" to find no one in the forum who was successful on using HTTPS-connections
    This was the reason for my question if HTTPS is working at all in pys60.

    cheers
    novis

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: HTTPS - possible in pys60 ?

    hi novis
    sorry as i didnt got your question.
    you point is a absolutely correct and has got a valid point. did u used HTTPS and if tried were you successful or what error did you got.
    plz give a feedback

  5. #5
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    Re: HTTPS - possible in pys60 ?

    @gaba88
    I did not try it so far.

    @all
    can someone pls. confirm that the use of HTTPS is working in a proper way or that it is not working.
    If yes, can someone provide a working (tested) example?

    cheers
    novis

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: HTTPS - possible in pys60 ?

    hi novis again
    i used HTTPS in my code and i dosent worked for me gave two different types of error.
    its better you also check it.
    thanks

  7. #7
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: HTTPS - possible in pys60 ?

    Quote Originally Posted by novis View Post
    @all
    can someone pls. confirm that the use of HTTPS is working in a proper way or that it is not working.
    There is a class called HTTSConnection, so in theory it should work. Please note, that class HTTPResponse debuglevel is by default 0. You should set it "higher" manually.

    Btw you didn't mention which S60 version you're using, things ARE different for 2nd and 3rd edition devices:

    # On S60 3rd Ed secure sockets must be given the expected
    # hostname before connecting or error -7547 occurs. This
    # is not needed on 2nd edition. See known issue KIS000322.
    ...in general: debug your code by trapping exceptions, writing useful strings into log file or use trace/profile.

    Cheers,

    --jouni

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: HTTPS - possible in pys60 ?

    hi jouni
    why the HTTPSconnection is not working in my case and giving errors but at the same function HTTP is working fine.

    waitin for your feedback.

  9. #9
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: HTTPS - possible in pys60 ?

    Quote Originally Posted by gaba88 View Post
    why the HTTPSconnection is not working in my case and giving errors but at the same function HTTP is working fine.
    What kind of errors? They sometimes contain useful info, unlile the generic System Error -50

    Code:
        SSL_ERROR_NONE=0
        SSL_ERROR_SSL=1
        SSL_ERROR_WANT_READ=2
        SSL_ERROR_WANT_WRITE=3
        SSL_ERROR_WANT_X509_LOOKUP=4 
        SSL_ERROR_SYSCALL=5
        SSL_ERROR_ZERO_RETURN=6
        SSL_ERROR_WANT_CONNECT=7
        SSL_ERROR_EOF=8
        SSL_ERROR_INVALID_ERROR_CODE=9
    It's not enought to change from HTTPConnection to HTTPSConnection, there are additional arguments:

    Code:
    class HTTPConnection:
        def __init__(self, host, port=None, strict=None, hostname=None):
    class HTTPSConnection(HTTPConnection):
        def __init__(self, host, port=None, key_file=None, cert_file=None,
                     strict=None, hostname=None):
    ...then there's the possibility that HTTPS might be buggy or not fully implemented. I have never tried it, so I'm walking on thin ice.

    --jouni

  10. #10
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    56

    Re: HTTPS - possible in pys60 ?

    https works fine for me
    if you try to connect to an ip instead of hostname you will
    need to send httpsconnection argument of hostname='bla.com' for example.
    you just send it anyway aswell since it doesnt matter what hostname it will get works for me anyway

  11. #11
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    Re: HTTPS - possible in pys60 ?

    @roidayan
    thx for replying,
    you seem to have some experience on using https-connections already.
    Could you please give a code example on how you connect to an host with https?

    many thx
    novis

  12. #12
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    56

    Re: HTTPS - possible in pys60 ?

    sure

    example1:

    conn = httplib.HTTPSConnection("www.hostname.com")
    conn.request("POST", "/login", params, headers)

    example2:

    conn = httplib.HTTPSConnection("xxx.xxx.xxx.xxx",hostname='bla.com')
    conn.request("POST", "/login", params, headers)

    ofcurse xxx.xxx.xxx.xxx is the ip you try to connect to.
    hostname should be the hostname of where you try to connect
    but i use bla.com for everywhere it works fine

  13. #13
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    Re: HTTPS - possible in pys60 ?

    @roidayan

    thx man.
    In my case I need to download a picture. I asume I'll need a GET instead of a POST.
    I'll try as soon as I can.

    cheers
    novis

  14. #14
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: HTTPS - possible in pys60 ?

    hi roidyan
    thanks for the solution i also got my HTTPS connection working.
    thanks

  15. #15
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Re: HTTPS - possible in pys60 ?

    Quote Originally Posted by gaba88 View Post
    hi roidyan
    thanks for the solution i also got my HTTPS connection working.
    thanks
    Can you show a little bit of code from your application?

    I don't know why, but I get an ACCESS_DENIED error all the time, and I would like to check how to add certificates to my queries, so the server does not complain. I guess that's my problem.

    Here comes my query:

    headers = {"Content-type": "application/html+xml","Accept": "text/plain"}
    conn = httplib.HTTPSConnection(servername2.text)
    conn.request("GET", serverpath2.text, '', headers)
    response2 = conn.getresponse()
    resp = response2.read()
    print resp

    servername2.text is my servername "didacgil.mymobilesite.net"
    serverpath2.text is the path "database/convert_to_XML.php"

    and the result should be an XML file that I can perfectly get when I query http://127.0.0.1/database/convert_to_XML.php, and I can perfectly parse.

    As you can imagine, I need HTTPS as if I want to get information from another PyS60, I will go through Nokia Gateway from Mobile Web Server.

    Thank you very much, I'm still learning

Similar Threads

  1. Can I use symbian generic .lib with PyS60?
    By gloria799 in forum Symbian
    Replies: 4
    Last Post: 2008-04-03, 13:25
  2. j2me https negotiation - Client Certificate
    By Nikolaos in forum Mobile Java Networking & Messaging & Security
    Replies: 9
    Last Post: 2008-01-21, 18:20
  3. how to distribute pys60 based apps?
    By chall3ng3r in forum Symbian
    Replies: 4
    Last Post: 2007-03-27, 14:13
  4. Replies: 0
    Last Post: 2006-03-06, 11:56
  5. J2ME Security : MIDP HTTPS vs Browser HTTPS
    By dhamodharan in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-09-11, 14:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×