Why QHttp can not upload file on fast PUT Method?
bytes 0 send incomming I have other script written on libcurl and runnig only on Window...
I like make this Put Method avaiable to all 3 os...
How i find the Bug?... on server is not required user or pass.... (only a valid cookie and libbcurl recive it ok...)
server say only:
<h1>Request Entity Too Large</h1>
The requested resource<br />/info.php<br />
does not allow request data with PUT requests, or the amount of data provided in
the request exceeds the capacity limit.
- bytes 0 send incomming </pa
/* class QCurl public */
void StartPutFile()
{
wwwput->setUser("","");
connect(wwwput, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool)));
}
/* RFC 2616 */
/* class QCurl public Http PUT Method */
{
QString dateiName
= beamfaq.
fileName();
wwwput->setHost(url.host(), 80);
logFile
= new QFile(LogFileapps
);
putFile
= new QFile(beamupfile
);
qint64 sizeallow = putFile->size();
header.setValue("Host", url.host());
header.setValue("Connection", "keep-alive");
header.setValue("User-Agent", WEBAGENTNAME );
header.
setValue("Content-length",
QString::number(sizeallow
));
qDebug() << "### beamfaq.size() " << sizeallow;
putid = wwwput->request(header, putFile, logFile);
return putid;
}
/* class QCurl public */
void StartPutFile()
{
wwwput = new QHttp();
wwwput->setUser("","");
connect(wwwput, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool)));
connect(wwwput, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
}
/* RFC 2616 */
/* class QCurl public Http PUT Method */
int Sender( QString beamupfile , QString posturl , QString LogFileapps )
{
QFileInfo beamfaq(beamupfile);
QString dateiName = beamfaq.fileName();
QUrl url(posturl);
wwwput->setHost(url.host(), 80);
logFile = new QFile(LogFileapps);
logFile->open(QIODevice::ReadWrite);
putFile = new QFile(beamupfile);
putFile->open(QIODevice::ReadOnly);
qint64 sizeallow = putFile->size();
QHttpRequestHeader header("PUT", url.path(),1,1); /* header */
header.setValue("Host", url.host());
header.setValue("Connection", "keep-alive");
header.setValue("User-Agent", WEBAGENTNAME );
header.setValue("Content-length",QString::number(sizeallow));
qDebug() << "### beamfaq.size() " << sizeallow;
putid = wwwput->request(header, putFile, logFile);
return putid;
}
To copy to clipboard, switch view to plain text mode
/* the server script work on libcurl PUT METHOD only window! and large file go up / Mac=no / Linux=no*/
<?php
if ($_SERVER['REQUEST_METHOD'] == "PUT") {
$content = file_get_contents("php://input");
$kb=file_put_contents(date("U")."_aa.pdf",$content);
header('Content-Type: text/xml; charset=utf-8');
echo "\n";
print '<parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml">';
print $_SERVER['HTTP_USER_AGENT']." - bytes ".$kb." send incomming ";
print '</parsererror>';
exit;
}
/*
curl_easy_setopt(curl_handle, CURLOPT_URL, sendurlwww );
curl_easy_setopt(curl_handle, CURLOPT_UPLOAD , TRUE );
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl_handle, CURLOPT_PUT , TRUE);
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT , 60 );
curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, xwcookiefile );
curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, xwcookiefile );
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "QT4 / PPK_W @ciz.ch" );
curl_easy_setopt(curl_handle,CURLOPT_STDERR , logfile );
curl_easy_setopt(curl_handle,CURLOPT_INFILE , beamupfile );
curl_easy_setopt(curl_handle,CURLOPT_INFILESIZE , des.size());
*/
?>
/* the server script work on libcurl PUT METHOD only window! and large file go up / Mac=no / Linux=no*/
<?php
if ($_SERVER['REQUEST_METHOD'] == "PUT") {
$content = file_get_contents("php://input");
$kb=file_put_contents(date("U")."_aa.pdf",$content);
header('Content-Type: text/xml; charset=utf-8');
echo "\n";
print '<parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml">';
print $_SERVER['HTTP_USER_AGENT']." - bytes ".$kb." send incomming ";
print '</parsererror>';
exit;
}
/*
curl_easy_setopt(curl_handle, CURLOPT_URL, sendurlwww );
curl_easy_setopt(curl_handle, CURLOPT_UPLOAD , TRUE );
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl_handle, CURLOPT_PUT , TRUE);
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT , 60 );
curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, xwcookiefile );
curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, xwcookiefile );
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "QT4 / PPK_W @ciz.ch" );
curl_easy_setopt(curl_handle,CURLOPT_STDERR , logfile );
curl_easy_setopt(curl_handle,CURLOPT_INFILE , beamupfile );
curl_easy_setopt(curl_handle,CURLOPT_INFILESIZE , des.size());
*/
?>
To copy to clipboard, switch view to plain text mode
Bookmarks