TreeFrogFramework  1.18
thttpheader.h
Go to the documentation of this file.
1 #ifndef THTTPHEADER_H
2 #define THTTPHEADER_H
3 
4 #include <TInternetMessageHeader>
5 #include <TCookie>
6 
7 
9 {
10 public:
11  THttpHeader();
12  THttpHeader(const THttpHeader &other);
13  THttpHeader(const QByteArray &str);
14  virtual ~THttpHeader() { }
15 
16  THttpHeader &operator=(const THttpHeader &other);
17  virtual QByteArray toByteArray() const;
18  virtual int majorVersion() const { return majVersion; }
19  virtual int minorVersion() const { return minVersion; }
20 
21 protected:
24 };
25 
26 
28 {
29 public:
32  THttpRequestHeader(const QByteArray &str);
34 
35  const QByteArray &method() const { return reqMethod; }
36  const QByteArray &path() const { return reqUri; }
37  void setRequest(const QByteArray &method, const QByteArray &path, int majorVer = 1, int minorVer = 1);
38  QByteArray cookie(const QString &name) const;
39  QList<TCookie> cookies() const;
40  virtual QByteArray toByteArray() const;
41 
42 private:
43  QByteArray reqMethod;
44  QByteArray reqUri;
45 };
46 
47 
49 {
50 public:
53  THttpResponseHeader(const QByteArray &str);
54 
55  int statusCode() const { return statCode; }
56  void setStatusLine(int code, const QByteArray &text = QByteArray(), int majorVer = 1, int minorVer = 1);
57  virtual QByteArray toByteArray() const;
59 
60 private:
61  int statCode;
62  QByteArray reasonPhr;
63 };
64 
65 #endif // THTTPHEADER_H
#define T_CORE_EXPORT
Definition: tglobal.h:81
The THttpHeader class is the abstract base class of request or response header information for HTTP...
Definition: thttpheader.h:8
const QByteArray & method() const
Returns the method of the HTTP request header.
Definition: thttpheader.h:35
The TInternetMessageHeader class contains internet message headers.
Definition: tinternetmessageheader.h:11
virtual ~THttpHeader()
Definition: thttpheader.h:14
The THttpRequestHeader class contains request header information for HTTP.
Definition: thttpheader.h:27
int majVersion
Definition: thttpheader.h:22
virtual QByteArray toByteArray() const
Returns a byte array representation of the HTTP header.
Definition: thttpheader.cpp:55
The THttpResponseHeader class contains response header information for HTTP.
Definition: thttpheader.h:48
const QByteArray & path() const
Returns the request-URI of the HTTP request header.
Definition: thttpheader.h:36
TInternetMessageHeader & operator=(const TInternetMessageHeader &other)
Assigns other to this internet message header and returns a reference to this header.
Definition: tinternetmessageheader.cpp:296
virtual int majorVersion() const
Returns the major protocol-version of the HTTP header.
Definition: thttpheader.h:18
THttpHeader & operator=(const THttpHeader &other)
Assigns other to this HTTP header and returns a reference to this HTTP header.
Definition: thttpheader.cpp:44
virtual int minorVersion() const
Returns the minor protocol-version of the HTTP header.
Definition: thttpheader.h:19
int statusCode() const
Returns the status code of the HTTP response header.
Definition: thttpheader.h:55
virtual QByteArray toByteArray() const
Sets the value of the header field Date to utc as Coordinated Universal Time.
Definition: tinternetmessageheader.cpp:192
int minVersion
Definition: thttpheader.h:23