Debian Codegraph @

Source/Network/HTTP/CQtHttpRequestBodyOnlyParser.h

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_NETWORK_HTTP_CQTHTTPREQUESTBODYONLYPARSER_H
22 #define KONCLUDE_NETWORK_HTTP_CQTHTTPREQUESTBODYONLYPARSER_H
23
24 // Namespace includes
25 #include "HttpSettings.h"
26 #include "CHttpRequest.h"
27 #include "CQtHttpRequest.h"
28 #include "CQtHttpRequestParser.h"
29
30
31 // Library includes
32 #include <QIODevice>
33
34 // Other includes
35
36
37 // Logger includes
38 #include "Logger/CLogger.h"
39
40
41 namespace Konclude {
42
43 namespace Network {
44
45 namespace HTTP {
46
47
48 /*!
49 *
50 * \class CQtHttpRequestBodyOnlyParser
51 * \author Andreas Steigmiller
52 * \version 0.1
53 * \brief TODO
54 *
55 */
56 class CQtHttpRequestBodyOnlyParser : public CQtHttpRequestParser {
57
58 // public methods
59 public:
60 //! Constructor
61 CQtHttpRequestBodyOnlyParser();
62
63 ~CQtHttpRequestBodyOnlyParser();
64
65 virtual CQtHttpRequestParser* reset();
66 virtual bool readFromDevice(QIODevice* readDevice);
67
68 virtual CHttpRequest* takeParsedHttpRequest();
69 virtual bool hasHttpRequestParsingError();
70 virtual bool hasHttpRequestParsingCompleted();
71 virtual bool hasRequestedCloseConnection();
72 virtual QString getHttpRequestParsingErrorString();
73
74 virtual QByteArray* takeBodyData();
75
76
77 // protected methods
78 protected:
79 void parseHttpRequestHeader();
80 void parseHttpMethodProtocolURI();
81
82 cint64 getNextCharacterPosition(char character, cint64 searchStartPos);
83
84
85 // protected variables
86 protected:
87 char* mHeaderLineReadBuffer;
88 cint64 mHeaderLineReadBufferSize;
89 cint64 mHeaderLineReadBufferPosition;
90 QByteArray mHeaderData;
91 cint64 mReadHeaderDataSize;
92 cint64 mMaxHeaderDataSize;
93 QString mRequestURIString;
94 QString mRequestMethod;
95 QString mRequestProtocol;
96 bool mHeaderMethodProtocolURIParsed;
97 bool mHeaderCompleted;
98
99 cint64 mExpectedBodyLength;
100 QByteArray* mBodyData;
101 cint64 mMaxBodyDataSize;
102 cint64 mReadBodyDataSize;
103 bool mRequestCompleted;
104 bool mRequestError;
105
106 QString mErrorString;
107
108 QString mHeaderContentLengthString;
109 QString mHeaderConnectionString;
110 QString mHeaderConnectionCloseString;
111
112 bool mAfterwardsCloseConnection;
113
114
115 // private methods
116 private:
117
118 // private variables
119 private:
120 };
121
122
123 }; // end namespace HTTP
124
125 }; // end namespace Network
126
127 }; // end namespace Konclude
128
129
130 #endif // KONCLUDE_NETWORK_HTTP_CQTHTTPREQUESTBODYONLYPARSER_H