mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-07 07:37:24 +03:00
Demote to helper function
Rename function
This commit is contained in:
parent
829e1399ca
commit
6cb2f05a6c
3 changed files with 5 additions and 10 deletions
|
@ -87,7 +87,7 @@ void Connection::read()
|
||||||
|
|
||||||
void Connection::sendResponse(const Response &response)
|
void Connection::sendResponse(const Response &response)
|
||||||
{
|
{
|
||||||
m_socket->write(ResponseGenerator::generate(response));
|
m_socket->write(toByteArray(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Connection::hasExpired(const qint64 timeout) const
|
bool Connection::hasExpired(const qint64 timeout) const
|
||||||
|
|
|
@ -35,9 +35,7 @@
|
||||||
|
|
||||||
#include "base/utils/gzip.h"
|
#include "base/utils/gzip.h"
|
||||||
|
|
||||||
using namespace Http;
|
QByteArray Http::toByteArray(Response response)
|
||||||
|
|
||||||
QByteArray ResponseGenerator::generate(Response response)
|
|
||||||
{
|
{
|
||||||
if (response.headers[HEADER_CONTENT_ENCODING] == "gzip") {
|
if (response.headers[HEADER_CONTENT_ENCODING] == "gzip") {
|
||||||
// A gzip seems to have 23 bytes overhead.
|
// A gzip seems to have 23 bytes overhead.
|
||||||
|
@ -69,7 +67,7 @@ QByteArray ResponseGenerator::generate(Response response)
|
||||||
return ret.toUtf8() + response.content;
|
return ret.toUtf8() + response.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResponseGenerator::httpDate()
|
QString Http::httpDate()
|
||||||
{
|
{
|
||||||
// [RFC 7231] 7.1.1.1. Date/Time Formats
|
// [RFC 7231] 7.1.1.1. Date/Time Formats
|
||||||
// example: "Sun, 06 Nov 1994 08:49:37 GMT"
|
// example: "Sun, 06 Nov 1994 08:49:37 GMT"
|
||||||
|
|
|
@ -37,11 +37,8 @@
|
||||||
|
|
||||||
namespace Http
|
namespace Http
|
||||||
{
|
{
|
||||||
namespace ResponseGenerator
|
QByteArray toByteArray(Response response);
|
||||||
{
|
|
||||||
QByteArray generate(Response response);
|
|
||||||
QString httpDate();
|
QString httpDate();
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HTTP_RESPONSEGENERATOR_H
|
#endif // HTTP_RESPONSEGENERATOR_H
|
||||||
|
|
Loading…
Reference in a new issue