TreeFrogFramework
2.10
Loading...
Searching...
No Matches
src
thttpheader.h
Go to the documentation of this file.
1
#pragma once
2
#include <TCookie>
3
#include <TInternetMessageHeader>
4
5
6
class
T_CORE_EXPORT
THttpHeader
:
public
TInternetMessageHeader
{
7
public
:
8
THttpHeader
();
9
THttpHeader
(
const
THttpHeader
&other);
10
THttpHeader
(
const
QByteArray &str);
11
virtual
~THttpHeader
() { }
12
13
THttpHeader
&
operator=
(
const
THttpHeader
&other);
14
virtual
QByteArray
toByteArray
()
const
;
15
virtual
int
majorVersion
()
const
{
return
_majorVersion; }
16
virtual
int
minorVersion
()
const
{
return
_minorVersion; }
17
18
protected
:
19
int
_majorVersion {1};
20
int
_minorVersion {1};
21
};
22
23
24
class
T_CORE_EXPORT
THttpRequestHeader
:
public
THttpHeader
{
25
public
:
26
THttpRequestHeader
();
27
THttpRequestHeader
(
const
THttpRequestHeader
&other);
28
THttpRequestHeader
(
const
QByteArray &str);
29
THttpRequestHeader
&
operator=
(
const
THttpRequestHeader
&other);
30
31
const
QByteArray &
method
()
const
{
return
_reqMethod; }
32
const
QByteArray &
path
()
const
{
return
_reqUri; }
33
void
setRequest(
const
QByteArray &method,
const
QByteArray &path,
int
majorVer = 1,
int
minorVer = 1);
34
QByteArray cookie(
const
QString &name)
const
;
35
QList<TCookie> cookies()
const
;
36
virtual
QByteArray
toByteArray
()
const
;
37
38
private
:
39
QByteArray _reqMethod;
40
QByteArray _reqUri;
41
};
42
43
44
class
T_CORE_EXPORT
THttpResponseHeader
:
public
THttpHeader
{
45
public
:
46
THttpResponseHeader
();
47
THttpResponseHeader
(
const
THttpResponseHeader
&other);
48
THttpResponseHeader
(
const
QByteArray &str);
49
50
int
statusCode
()
const
{
return
_statusCode; }
51
void
setStatusLine(
int
code,
const
QByteArray &text = QByteArray(),
int
majorVer = 1,
int
minorVer = 1);
52
virtual
QByteArray
toByteArray
()
const
;
53
THttpResponseHeader
&
operator=
(
const
THttpResponseHeader
&other);
54
void
clear
();
55
56
private
:
57
int
_statusCode {0};
58
QByteArray _reasonPhrase;
59
};
60
THttpHeader
The THttpHeader class is the abstract base class of request or response header information for HTTP.
Definition
thttpheader.h:6
THttpHeader::minorVersion
virtual int minorVersion() const
Returns the minor protocol-version of the HTTP header.
Definition
thttpheader.h:16
THttpHeader::~THttpHeader
virtual ~THttpHeader()
Definition
thttpheader.h:11
THttpHeader::majorVersion
virtual int majorVersion() const
Returns the major protocol-version of the HTTP header.
Definition
thttpheader.h:15
THttpRequestHeader
The THttpRequestHeader class contains request header information for HTTP.
Definition
thttpheader.h:24
THttpRequestHeader::method
const QByteArray & method() const
Returns the method of the HTTP request header.
Definition
thttpheader.h:31
THttpRequestHeader::path
const QByteArray & path() const
Returns the request-URI of the HTTP request header.
Definition
thttpheader.h:32
THttpResponseHeader
The THttpResponseHeader class contains response header information for HTTP.
Definition
thttpheader.h:44
THttpResponseHeader::statusCode
int statusCode() const
Returns the status code of the HTTP response header.
Definition
thttpheader.h:50
TInternetMessageHeader
The TInternetMessageHeader class contains internet message headers.
Definition
tinternetmessageheader.h:9
TInternetMessageHeader::operator=
TInternetMessageHeader & operator=(const TInternetMessageHeader &other)
Assigns other to this internet message header and returns a reference to this header.
Definition
tinternetmessageheader.cpp:299
TInternetMessageHeader::clear
void clear()
Removes all the entries from the Internet message header.
Definition
tinternetmessageheader.cpp:289
TInternetMessageHeader::toByteArray
virtual QByteArray toByteArray() const
Sets the value of the header field Date to utc as Coordinated Universal Time.
Definition
tinternetmessageheader.cpp:193
T_CORE_EXPORT
#define T_CORE_EXPORT
Definition
tdeclexport.h:28