Nuria Framework - Network
Network module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator
httpparser.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_HTTPPARSER_HPP
19 #define NURIA_HTTPPARSER_HPP
20 
21 #include "httpclient.hpp"
22 #include <QByteArray>
23 
24 class QIODevice;
25 
26 namespace Nuria {
27 
31 class NURIA_NETWORK_EXPORT HttpParser {
32 public:
34  HttpParser ();
35 
37  ~HttpParser ();
38 
43  bool removeTrailingNewline (QByteArray &data);
44 
50  bool parseFirstLine (const QByteArray &data, QByteArray &verb, QByteArray &path,
51  QByteArray &version);
56  bool parseHeaderLine (const QByteArray &data, QByteArray &name, QByteArray &value);
57 
62  HttpClient::HttpVersion parseVersion (const QByteArray &version);
63 
68  HttpClient::HttpVerb parseVerb (const QByteArray &verb);
69 
75  bool parseRangeHeaderValue (const QByteArray &value, qint64 &begin, qint64 &end);
76 
81  QByteArray correctHeaderKeyCase (QByteArray key);
82 
87  bool parseCookies (const QByteArray &data, HttpClient::Cookies &target);
88 
94  bool parseFirstLineFull (const QByteArray &line, HttpClient::HttpVerb &verb,
95  QByteArray &path, HttpClient::HttpVersion &version);
96 };
97 
98 
99 }
100 
101 #endif // NURIA_HTTPPARSER_HPP
Parser functions for the HyperText Transfer Protocol.
Definition: httpparser.hpp:31
QMap< QByteArray, QNetworkCookie > Cookies
Definition: httpclient.hpp:420
HttpVerb
Definition: httpclient.hpp:112
HttpVersion
Definition: httpclient.hpp:102