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
|
" " + // space
|
||||||
context.reply->url().toString() + // write url
|
context.reply->url().toString() + // write url
|
||||||
" " + // space
|
" " + // space
|
||||||
QString::number(context.reply->attribute(QNetworkRequest::HttpStatusCodeAttribute))
|
QString::number(context.reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()) //
|
||||||
+ // write status
|
+ // write status
|
||||||
"\n" // newline
|
"\n" // newline
|
||||||
)
|
)
|
||||||
|
@ -308,7 +308,9 @@ void CustomUploader::doUpload(QByteArray imgData, QString format) {
|
|||||||
if (i < split.size() - 1) body.append(imgData);
|
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);
|
buffer->open(QIODevice::ReadOnly);
|
||||||
part.setBodyDevice(buffer);
|
part.setBodyDevice(buffer);
|
||||||
multipart->append(part);
|
multipart->append(part);
|
||||||
@ -327,7 +329,7 @@ void CustomUploader::doUpload(QByteArray imgData, QString format) {
|
|||||||
str = str.mid(1, str.length() - 1).replace("%contenttype", mime);
|
str = str.mid(1, str.length() - 1).replace("%contenttype", mime);
|
||||||
part.setRawHeader(headerVal.toLatin1(), str.toLatin1());
|
part.setRawHeader(headerVal.toLatin1(), str.toLatin1());
|
||||||
} else
|
} else
|
||||||
cdh += "; " + headerVal + ": \"" + valo[headerVal].toString().replace("\"", "\\\"") + "\"";
|
cdh += "; " + headerVal + "= \"" + valo[headerVal].toString().replace("\"", "\\\"") + "\"";
|
||||||
}
|
}
|
||||||
part.setHeader(QNetworkRequest::ContentDispositionHeader, cdh);
|
part.setHeader(QNetworkRequest::ContentDispositionHeader, cdh);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user