Nuria Framework - Network
Network module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator
httpwriter.hpp
1 /* Copyright (c) 2014, The Nuria Project
2  * This software is provided 'as-is', without any express or implied
3  * warranty. In no event will the authors be held liable for any damages
4  * arising from the use of this software.
5  * Permission is granted to anyone to use this software for any purpose,
6  * including commercial applications, and to alter it and redistribute it
7  * freely, subject to the following restrictions:
8  * 1. The origin of this software must not be misrepresented; you must not
9  * claim that you wrote the original software. If you use this software
10  * in a product, an acknowledgment in the product documentation would be
11  * appreciated but is not required.
12  * 2. Altered source versions must be plainly marked as such, and must not be
13  * misrepresented as being the original software.
14  * 3. This notice may not be removed or altered from any source
15  * distribution.
16  */
17 
18 #ifndef NURIA_HTTPWRITER_HPP
19 #define NURIA_HTTPWRITER_HPP
20 
21 #include "httpclient.hpp"
22 #include <QByteArray>
23 
24 namespace Nuria {
25 
29 class NURIA_NETWORK_EXPORT HttpWriter {
30 public:
31 
33  HttpWriter ();
34 
38  QByteArray httpVersionToString (HttpClient::HttpVersion version);
39 
45  QByteArray writeResponseLine (HttpClient::HttpVersion version, int statusCode,
46  const QByteArray &message);
47 
51  QByteArray writeSetCookies (const HttpClient::Cookies &cookies);
52 
59  QByteArray writeSetCookieValue (const QNetworkCookie &cookie);
60 
64  QByteArray writeHttpHeaders (const HttpClient::HeaderMap &headers);
65 
70  QByteArray dateTimeToHttpDateHeader (const QDateTime &dateTime);
71 
75  QByteArray buildRangeHeader (qint64 begin, qint64 end, qint64 totalLength);
76 
81  void addComplianceHeaders (HttpClient::HttpVersion version, HttpClient::HeaderMap &headers);
82 
91  void applyRangeHeaders (qint64 begin, qint64 end, qint64 totalLength,
92  HttpClient::HeaderMap &headers);
93 private:
94 
95 };
96 
97 }
98 
99 #endif // NURIA_HTTPWRITER_HPP
QMultiMap< QByteArray, QByteArray > HeaderMap
Definition: httpclient.hpp:172
Writer for HTTP data.
Definition: httpwriter.hpp:29
QMap< QByteArray, QNetworkCookie > Cookies
Definition: httpclient.hpp:420
HttpVersion
Definition: httpclient.hpp:102