Nuria Framework - Network
Network module of the NuriaProject Framework
Main Page
Classes
Files
File List
All
Classes
Functions
Typedefs
Enumerations
Enumerator
Framework
Network
httpmultipartreader.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_HTTPMULTIPARTREADER_HPP
19
#define NURIA_HTTPMULTIPARTREADER_HPP
20
21
#include "httppostbodyreader.hpp"
22
23
namespace
Nuria {
24
25
class
HttpMultiPartReaderPrivate;
26
class
TemporaryBufferDevice;
27
44
class
NURIA_NETWORK_EXPORT
HttpMultiPartReader
:
public
HttpPostBodyReader
{
45
Q_OBJECT
46
public
:
47
51
HttpMultiPartReader
(QIODevice *device,
const
QByteArray &boundary, QObject *parent =
nullptr
);
52
54
~
HttpMultiPartReader
();
55
56
bool
isComplete ()
const override
;
57
bool
hasFailed ()
const override
;
58
bool
hasField (
const
QString &field)
const override
;
59
QStringList fieldNames ()
const override
;
60
QString fieldMimeType (
const
QString &field)
const override
;
61
qint64 fieldLength (
const
QString &field)
const override
;
62
qint64 fieldBytesTransferred (
const
QString &field)
const override
;
63
bool
isFieldComplete (
const
QString &field)
const override
;
64
QIODevice *fieldStream (
const
QString &field)
override
;
65
66
private
:
67
68
void
setState (
int
state);
69
void
processData ();
70
void
processChunk ();
71
bool
processChunkStep ();
72
int
processFirstLine ();
73
int
processAllHeaders ();
74
int
processHeaders (
int
offset);
75
bool
processHeaderLine (
const
QByteArray &line);
76
bool
parseHeaders ();
77
qint64 parseContentLength (
const
QByteArray &data);
78
QString parseContentDispositionValue (
const
QByteArray &data);
79
QString parseContentDispositionFormDataValue (
const
QByteArray &data);
80
int
processContent ();
81
int
isBoundingLine (
const
QByteArray &buffer,
bool
&last,
int
offset);
82
int
boundingLineLength ()
const
;
83
void
stopListening ();
84
int
appendToCurrentBuffer (
const
QByteArray &data,
int
length);
85
int
processContentBoundary (
int
idxOfNewline);
86
void
initCurrentBuffer (
const
QString &name, TemporaryBufferDevice *device);
87
88
HttpMultiPartReaderPrivate *d_ptr;
89
90
};
91
92
}
93
94
#endif // NURIA_HTTPMULTIPARTREADER_HPP
Nuria::HttpPostBodyReader
Abstract class for readers of the body of HTTP POST requests.
Definition:
httppostbodyreader.hpp:41
Nuria::HttpMultiPartReader
Reader for HTTP multi-part formatted data.
Definition:
httpmultipartreader.hpp:44
Generated on Sun Jun 29 2014 23:49:08 for Nuria Framework - Network by
1.8.7