Results 1 to 4 of 4

Thread: QTcpSocket proxy authentication problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default Re: QTcpSocket proxy authentication problem

    yes i tried that class also . but i couldnt get it work. Maybe i am using that wrong.

    When using QTcpSocket i connect to the proxy server.

    Qt Code:
    1. s.connectToHost("yy.yy.yy.yy",8080);// yy.yy.yy.yy:8080 is the proxy address
    To copy to clipboard, switch view to plain text mode 

    and send server the message below;

    POST http://xx.xx.xx.xx/ HTTP/1.1
    User-Agent: TSS Client
    Host: xx.xx.xx.xx
    Proxy-Connection: Keep-Alive
    Content-Length: 61
    Content-Type: application/timestamp-query
    Identity: 304d0201010410a6ee0e6ddf04fd7e0f36a41708071a850202 07d004105f0ffc985e9c03361f5e11d8bf674e10042007320d c4190c712f1dfb94ced2e983a886674d2a9600ca3fec5e5c56 31e9d73c

    <...requestbody...>




    how can i do the same with QNetworkAccessManager?
    I read the doc about QNetworkAccessManager;
    I set the proxy of manager with setProxy() and tried post(...) method with several combinations , connected all of the signals it emits to slots. but couldnt see anything coming from the server.

    can you explain how can i use QNetworkAccessManager to make the above request.?
    How should i init QNetworkRequest object when posting? should i post to my destination(xx.xx.xx.xx)
    or the proxy server(yy.yy.yy.yy).

    a piece of code ?

    thanks.

  2. #2
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: QTcpSocket proxy authentication problem

    Generally speaking you have to query your destination directly, and set the proxy ip/user/pass in QNetworkProxy .

    But..I usually work with QNetworkAccessManager behind a ISA proxy when I'm testing my app at work, and I can't connect to the proxy server directly because...my ISA server uses NTLM v2 hashes and Qt don't support them.
    At least until version 4.5 (from QAuthenticator documentation):
    QAuthenticator supports the following authentication methods:

    Basic
    NTLM version 1
    Digest-MD5
    Note that, in particular, NTLM version 2 is not supported.
    To my surprise version 4.5.2 misses this notice, but you can read from google cache: http://209.85.129.132/search?q=cache...&ct=clnk&gl=it

    It doesn't seem that nokia improved qauthenticator (at least there's nothing about it in 4.5.1 and 4.5.2 changelog), and anyway it it still not working for me.

    There IS a solution indeed, at least for your development machine: use CNTLM on your computer, and point your qt app to the following proxy "localhost:3128" (that is default cntlm port).
    Obviously you need to configure and run CNTLM before

    Hope this helps

Similar Threads

  1. Challenging QTcpSocket reliability problem
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 13th January 2009, 11:38
  2. array of pointers to QtcpSocket
    By gQt in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th June 2008, 10:15
  3. QTcpServer & QTcpSocket questions...
    By jxmot in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2008, 22:38
  4. QTcpSocket and libssh2 ...
    By sandros in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2007, 23:34
  5. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 21:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.