Results 1 to 4 of 4

Thread: Ssl problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Moscow, Russia
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Ssl problems

    Hi!
    I am trying to write program which shows amount of money on my ISP account. The idea is to pass a POST request to index.php and receive generated html page, but there is ssl installed and that is a problem. When I am trying to pass my login and password to index.php through my program, as an output i receive main page as if login or password is incorrect.
    Qt Code:
    1. #ifndef STAT_H
    2. #define STAT_H
    3. #include <QtNetwork>
    4. #include <QtGui>
    5.  
    6. #include "ui_stat.h"
    7.  
    8. class Stat : public QDialog, public Ui::dialog
    9. {
    10. Q_OBJECT
    11. public:
    12. Stat (const QString &host)
    13. {
    14. setupUi ( this );
    15. connect (&http, SIGNAL( requestFinished(int,bool)),this,SLOT(end()));
    16. connect ( statButton, SIGNAL ( clicked ( ) ), this, SLOT ( send ( ) ) );
    17. http.setHost ( host, QHttp::ConnectionModeHttps );
    18. }
    19.  
    20.  
    21. void sendData (const QString &input1, const QString &input2 )
    22. {
    23. data.append ( "FindUserName=");
    24. data.append (input1);
    25. data.append ( "&FindUserPass=");
    26. data.append ( input2 );
    27. outFile .setFileName ( "out.html" );
    28. outFile.open (QIODevice:: WriteOnly | QIODevice::Truncate);
    29. QSslSocket *socket = new QSslSocket;
    30. socket->connectToHostEncrypted ( "stat.ultranet.ru", 443 );
    31. if ( socket->waitForEncrypted ( 5000) )
    32. {
    33. http.setSocket ( socket );
    34. QHttpRequestHeader header ( "POST", "/index.php" );
    35. header.setValue ( "Content-Type", "application/x-www-form-urlencoded" );
    36. header.setValue ( "Host", "stat.ultranet.ru" );
    37. http.request ( header, data, &outFile );
    38. }
    39. }
    40.  
    41. public slots:
    42. void end( )
    43. {
    44. outFile.close ( );
    45. emit done();
    46. }
    47.  
    48. void send ( )
    49. {
    50. sendData ( loginLineEdit ->text( ), passwLineEdit ->text( ) ) ;
    51. }
    52.  
    53.  
    54.  
    55. signals:
    56. void done( );
    57. private:
    58. QFile outFile;
    59. QHttp http;
    60. QByteArray data;
    61. };
    62. #endif
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Oct 2007
    Location
    Moscow, Russia
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Ssl problems

    Problem solved

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Ssl problems

    What was the problem?

  4. #4
    Join Date
    Oct 2007
    Location
    Moscow, Russia
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Ssl problems

    I was just sending wrong string is POST request. The right one is "action=login&FindUserName=mylogin&FindUserPass=my pass" instead of "FindUserName=mylogin&FindUserPass=mypass". I figured this out when intercepted POST request from IE.

  5. The following user says thank you to Unplugged for this useful post:

    jacek (4th October 2007)

Similar Threads

  1. Few general problems
    By Salazaar in forum Newbie
    Replies: 9
    Last Post: 13th June 2007, 23:44
  2. Problems installing on MacOS X
    By a5char in forum Installation and Deployment
    Replies: 2
    Last Post: 26th March 2007, 22:45
  3. Replies: 2
    Last Post: 8th March 2007, 23:22
  4. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 16:39
  5. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 11:28

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.