Commit 6a30d8d3 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

code style and consistency in naming between reply and request

parent c8a524b3
......@@ -109,7 +109,7 @@ void QtHttpClientWrapper::onClientDataReceived () {
qDebug () << "Debug : HTTP"
<< "content :" << m_currentRequest->getRawData ().toHex ()
<< "size :" << m_currentRequest->getRawData ().size ();
if (m_currentRequest->getRawData ().size () == m_currentRequest->getHeader (QtHttpHeader::ContentLength).toInt ()) {
if (m_currentRequest->getRawDataSize () == m_currentRequest->getHeader (QtHttpHeader::ContentLength).toInt ()) {
qDebug () << "Debug : HTTP end of content";
m_parsingStatus = RequestParsed;
}
......@@ -167,7 +167,7 @@ QtHttpClientWrapper::ParsingStatus QtHttpClientWrapper::sendReplyToClient (QtHtt
// empty line
data.append (CRLF);
// content raw data
data.append (reply->getResponseData ());
data.append (reply->getRawData ());
// write to socket
qDebug () << "Debug: reply=" << data;
m_sockClient->write (data);
......
......@@ -12,7 +12,7 @@ QtHttpReply::QtHttpReply (QtHttpServer * parent)
, m_serverHandle (parent)
{
// set some additional headers
addHeader (QtHttpHeader::Date, QDateTime::currentDateTimeUtc ().toString ("ddd, dd MMM yyyy hh:mm:ss t").toLatin1 ());
addHeader (QtHttpHeader::Date, QDateTime::currentDateTimeUtc ().toString ("ddd, dd MMM yyyy hh:mm:ss t").toUtf8 ());
addHeader (QtHttpHeader::Server, m_serverHandle->getServerName ().toUtf8 ());
}
......@@ -24,7 +24,7 @@ QtHttpReply::StatusCode QtHttpReply::getStatusCode () const {
return m_statusCode;
}
QByteArray QtHttpReply::getResponseData () const {
QByteArray QtHttpReply::getRawData () const {
return m_data;
}
......
......@@ -21,7 +21,7 @@ public:
int getRawDataSize () const;
StatusCode getStatusCode () const;
QByteArray getResponseData () const;
QByteArray getRawData () const;
QList<QByteArray> getHeadersList () const;
QByteArray getHeader (QByteArray header) const;
......
......@@ -19,6 +19,11 @@ QUrl QtHttpRequest::getUrl () const {
return m_url;
}
int QtHttpRequest::getRawDataSize () const {
return m_data.size ();
}
QByteArray QtHttpRequest::getRawData () const {
return m_data;
}
......
......@@ -13,6 +13,7 @@ class QtHttpRequest : public QObject {
public:
explicit QtHttpRequest (QtHttpServer * parent);
int getRawDataSize () const;
QUrl getUrl () const;
QByteArray getRawData () const;
QList<QByteArray> getHeadersList () const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment