Some changes to try and fix multipart
This commit is contained in:
parent
b17edd323e
commit
54acaa3cb4
@ -17,7 +17,7 @@ void requestlogging::addEntry(RequestContext context) {
|
||||
" " + // space
|
||||
context.reply->url().toString() + // write url
|
||||
" " + // space
|
||||
QString::number(context.reply->attribute(QNetworkRequest::HttpStatusCodeAttribute))
|
||||
QString::number(context.reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()) //
|
||||
+ // write status
|
||||
"\n" // newline
|
||||
)
|
||||
|
@ -308,7 +308,9 @@ void CustomUploader::doUpload(QByteArray imgData, QString format) {
|
||||
if (i < split.size() - 1) body.append(imgData);
|
||||
}
|
||||
}
|
||||
QBuffer *buffer = new QBuffer(&imgData);
|
||||
QByteArray *bodyHeap = new QByteArray;
|
||||
body.swap(*bodyHeap);
|
||||
QBuffer *buffer = new QBuffer(bodyHeap);
|
||||
buffer->open(QIODevice::ReadOnly);
|
||||
part.setBodyDevice(buffer);
|
||||
multipart->append(part);
|
||||
@ -327,7 +329,7 @@ void CustomUploader::doUpload(QByteArray imgData, QString format) {
|
||||
str = str.mid(1, str.length() - 1).replace("%contenttype", mime);
|
||||
part.setRawHeader(headerVal.toLatin1(), str.toLatin1());
|
||||
} else
|
||||
cdh += "; " + headerVal + ": \"" + valo[headerVal].toString().replace("\"", "\\\"") + "\"";
|
||||
cdh += "; " + headerVal + "= \"" + valo[headerVal].toString().replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
part.setHeader(QNetworkRequest::ContentDispositionHeader, cdh);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user