From subjekt ....

If i Launch a Request PUT on http header not run! on QT4.3 beta
return only unknow error....

if i take my projekt ( http://sourceforge.net/projects/qt-webdav/ ) on qt4.2 can build and run ok on QT4.3beta can compile & run ... but can not upload file on method PUT..

RFC Standard are GET,POST,PUT,OPTIONS,HEAD,DELETE
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Upload file on PUT having more speed as POST.......

QHttp::state() stay 0 QHttp::Unconnected

Anybody know this as Bug? or you have a Answer?


Qt Code:
  1. int main(int argc, char* argv[])
  2. {
  3. QApplication app(argc, argv);
  4. qDebug() << "### start main ";
  5. PutSender *job = new PutSender(QUrl("http://www.qtcentre.org/"),"a.zip");
  6. return app.exec();
  7. }
To copy to clipboard, switch view to plain text mode 

Method PUT Upload ....

Qt Code:
  1. #ifndef BASE_BUTTON_H
  2. #define BASE_BUTTON_H
  3.  
  4. #include <QString>
  5. #include <QDebug>
  6. #include <QObject>
  7. #include <QHttp>
  8. #include <QAbstractSocket>
  9. #include <QFileInfo>
  10. #include <QHttp>
  11. #include <QUrl>
  12. #include <QtGui>
  13. #include <QTimer>
  14.  
  15.  
  16. #if defined Q_WS_MAC
  17. #define WEBAGENTNAME "Mac QT4 / PPK_W @ciz.ch"
  18. #endif
  19. #if defined Q_WS_WIN
  20. #define WEBAGENTNAME "Windows QT4 / PPK_W @ciz.ch"
  21. #endif
  22. #if defined Q_WS_X11
  23. #define WEBAGENTNAME "Unix QT4 / PPK_W @ciz.ch"
  24. #endif
  25. typedef QMap<int, QStringList> cookiepam; /* cookie */
  26. typedef QMap<QString, QString> ParamVar; /* xml params store */
  27.  
  28. class PutSender : public QObject
  29. {
  30. Q_OBJECT
  31. /* #####################url#############uploadfiel#######*/
  32. public: PutSender( QUrl urigo , QString locfile )
  33. {
  34. urigoup = QUrl(urigo);
  35. davinfo = new QHttp();
  36. BeamUp = new QFile(locfile); /* upload file */
  37.  
  38. if (BeamUp->exists()) {
  39. //////byteArray.clear();
  40. //////BeamLog = new QBuffer(); /* buffer */
  41. //////BeamLog->setBuffer(&byteArray);
  42. ////////BeamLog->open(QIODevice::ReadWrite);
  43. logFile = new QFile("log.txt");
  44. logFile->open(QIODevice::ReadWrite);
  45. BeamUp = new QFile(locfile);
  46. BeamUp->open(QIODevice::ReadOnly);
  47. QHttpRequestHeader header("PUT", urigoup.path() ,1,1); /* header */
  48. header.setValue("Host",urigoup.host());
  49. header.setValue("User-Agent", WEBAGENTNAME );
  50. header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
  51. header.setValue("Accept-Language", "it,de-de;q=0.8,it-it;q=0.6,en-us;q=0.4,en;q=0.2");
  52. header.setValue("Connection", "keep-alive");
  53. david = davinfo->request(header,BeamUp,logFile);
  54. qDebug() << "### david " << david;
  55. connect(davinfo, SIGNAL(dataSendProgress(int, int)), this, SLOT(SendStatus(int, int)));
  56. connect(davinfo, SIGNAL(stateChanged(int)), this, SLOT(State(int)));
  57. connect(davinfo, SIGNAL(requestStarted(int)), this, SLOT(Started(int)));
  58. Debugme();
  59.  
  60. } else {
  61. ErrorMSG("File upload not found!");
  62. }
  63. }
  64. protected:
  65. int david;
  66. QUrl urigoup;
  67. QHttp *davinfo;
  68. QFile *BeamUp;
  69. QFile *logFile;
  70. QBuffer *BeamLog;
  71. QByteArray byteArray;
  72.  
  73.  
  74. private:
  75. signals:
  76. public slots:
  77. void State( int a1 )
  78. {
  79. qDebug() << "### state " << a1;
  80. }
  81. void Started( int a1 )
  82. {
  83. qDebug() << "### strted " << a1;
  84. }
  85. void Debugme()
  86. {
  87. qDebug() << "### debug state 0/6 scala " << davinfo->state();
  88. qDebug() << "### error " << davinfo->error();
  89. QTimer::singleShot(1000, this, SLOT(Debugme()));
  90. }
  91.  
  92. void SendStatus( int tot , int stats )
  93. {
  94. qDebug() << "### status " << tot << "-" << stats;
  95. }
  96. void ErrorMSG( const QString message )
  97. {
  98. qDebug() << "### message " << message;
  99. }
  100.  
  101. };
  102.  
  103. #endif // BASE_BUTTON_H
To copy to clipboard, switch view to plain text mode