QHttp RFC Method PUT not work.
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?
Code:
int main(int argc, char* argv[])
{
qDebug() << "### start main ";
PutSender
*job
= new PutSender
(QUrl("http://www.qtcentre.org/"),
"a.zip");
return app.exec();
}
Method PUT Upload ....
Code:
#ifndef BASE_BUTTON_H
#define BASE_BUTTON_H
#include <QString>
#include <QDebug>
#include <QObject>
#include <QHttp>
#include <QAbstractSocket>
#include <QFileInfo>
#include <QHttp>
#include <QUrl>
#include <QtGui>
#include <QTimer>
#if defined Q_WS_MAC
#define WEBAGENTNAME "Mac QT4 / PPK_W @ciz.ch"
#endif
#if defined Q_WS_WIN
#define WEBAGENTNAME "Windows QT4 / PPK_W @ciz.ch"
#endif
#if defined Q_WS_X11
#define WEBAGENTNAME "Unix QT4 / PPK_W @ciz.ch"
#endif
typedef QMap<int, QStringList> cookiepam; /* cookie */
typedef QMap<QString, QString> ParamVar; /* xml params store */
{
Q_OBJECT
/* #####################url#############uploadfiel#######*/
{
BeamUp
= new QFile(locfile
);
/* upload file */
if (BeamUp->exists()) {
//////byteArray.clear();
//////BeamLog = new QBuffer(); /* buffer */
//////BeamLog->setBuffer(&byteArray);
////////BeamLog->open(QIODevice::ReadWrite);
logFile
= new QFile("log.txt");
BeamUp
= new QFile(locfile
);
header.setValue("Host",urigoup.host());
header.setValue("User-Agent", WEBAGENTNAME );
header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
header.setValue("Accept-Language", "it,de-de;q=0.8,it-it;q=0.6,en-us;q=0.4,en;q=0.2");
header.setValue("Connection", "keep-alive");
david = davinfo->request(header,BeamUp,logFile);
qDebug() << "### david " << david;
connect(davinfo, SIGNAL(dataSendProgress(int, int)), this, SLOT(SendStatus(int, int)));
connect(davinfo, SIGNAL(stateChanged(int)), this, SLOT(State(int)));
connect(davinfo, SIGNAL(requestStarted(int)), this, SLOT(Started(int)));
Debugme();
} else {
ErrorMSG("File upload not found!");
}
}
protected:
int david;
private:
signals:
public slots:
void State( int a1 )
{
qDebug() << "### state " << a1;
}
void Started( int a1 )
{
qDebug() << "### strted " << a1;
}
void Debugme()
{
qDebug() << "### debug state 0/6 scala " << davinfo->state();
qDebug() << "### error " << davinfo->error();
QTimer::singleShot(1000,
this,
SLOT(Debugme
()));
}
void SendStatus( int tot , int stats )
{
qDebug() << "### status " << tot << "-" << stats;
}
void ErrorMSG
( const QString message
) {
qDebug() << "### message " << message;
}
};
#endif // BASE_BUTTON_H
Re: QHttp RFC Method PUT not work.
Did you set the host in the QHttp object?
Re: QHttp RFC Method PUT not work.
Quote:
Originally Posted by
wysota
Did you set the host in the QHttp object?
Yes original is it...
the same problem is on my source ...
http://sourceforge.net/project/showf...kage_id=222560
to build i downgrade to :
QMake version 2.01a
Using Qt version 4.2.3 in D:\qt\lib
the problem is only upload .. on qt4.3 beta ...
https://qt-webdav.svn.sourceforge.ne...r/dav/davput.h
i not tested on http://labs.trolltech.com/blogs/2007...30-rc1-is-out/
Make yourself a free 5MB webdav account to test
https://www.sharemation.com/xythoswf...action=newuser
IMO: is not apache2 but header-responder comming...
Code:
{
Q_OBJECT
/* #####################url#############uploadfiel#######*/
{
davinfo->setHost(urigoup.host(), 80);
BeamUp
= new QFile(locfile
);
/* upload file */ starter = 0;
Re: QHttp RFC Method PUT not work.
Could you provide a minimal compilable example reproducing the problem?
Re: QHttp RFC Method PUT not work.
Quote:
Originally Posted by
wysota
Could you provide a minimal compilable example reproducing the problem?
Hurra sorry i found the bug on write && rewrite the minimal example on a single file main.cpp......
on QUrl correct is : QUrl("http://user:pass@www.sharemation.com/ppkciz/")
QUrl("http://user:pass@hostname.com/path/")
correct is...
Code:
std::cout << "Main start Process ID:" << getpid() << std::endl;
/* User ID:" << getuid() unix */
/* Get Option from remote server */
HTTP_option
*job
= new HTTP_option
(QUrl("http://user:pass@www.sharemation.com/ppkciz/"));
well on a other projekt i use :
mysql://user:pass@host:portnr/database to pass argument on main argv[] ....
and i replace qurl path ///
so QString dbase = dns.path().replace("/","");
to become the correct database name... als path...
i confused the path after whitout // on a copy & paste function
the QUrl is great to pass argument and scheme but must work exact!....
Code:
QString dbase
= dns.
path().
replace("/",
"");
if (!drivers.contains("QMYSQL")) {
std::cout << "### Load QMYSQL Driver Fail!." << std::endl;
return;
}
db0.setHostName(dns.host());
db0.setDatabaseName(dbase);
db0.setUserName(dns.userName());
db0.setPassword(dns.password());
if (dns.port() > 0) {
db0.setPort(dns.port());
}
if (!db0.open()) {
...........