source: trunk/src/network/access/qnetworkrequest.h@ 807

Last change on this file since 807 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 4.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtNetwork module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QNETWORKREQUEST_H
43#define QNETWORKREQUEST_H
44
45#include <QtCore/QSharedDataPointer>
46#include <QtCore/QString>
47#include <QtCore/QUrl>
48#include <QtCore/QVariant>
49
50QT_BEGIN_HEADER
51
52QT_BEGIN_NAMESPACE
53
54QT_MODULE(Network)
55
56class QSslConfiguration;
57
58class QNetworkRequestPrivate;
59class Q_NETWORK_EXPORT QNetworkRequest
60{
61public:
62 enum KnownHeaders {
63 ContentTypeHeader,
64 ContentLengthHeader,
65 LocationHeader,
66 LastModifiedHeader,
67 CookieHeader,
68 SetCookieHeader
69 };
70 enum Attribute {
71 HttpStatusCodeAttribute,
72 HttpReasonPhraseAttribute,
73 RedirectionTargetAttribute,
74 ConnectionEncryptedAttribute,
75 CacheLoadControlAttribute,
76 CacheSaveControlAttribute,
77 SourceIsFromCacheAttribute,
78 DoNotBufferUploadDataAttribute,
79 HttpPipeliningAllowedAttribute,
80 HttpPipeliningWasUsedAttribute,
81
82 User = 1000,
83 UserMax = 32767
84 };
85 enum CacheLoadControl {
86 AlwaysNetwork,
87 PreferNetwork,
88 PreferCache,
89 AlwaysCache
90 };
91
92 explicit QNetworkRequest(const QUrl &url = QUrl());
93 QNetworkRequest(const QNetworkRequest &other);
94 ~QNetworkRequest();
95 QNetworkRequest &operator=(const QNetworkRequest &other);
96
97 bool operator==(const QNetworkRequest &other) const;
98 inline bool operator!=(const QNetworkRequest &other) const
99 { return !operator==(other); }
100
101 QUrl url() const;
102 void setUrl(const QUrl &url);
103
104 // "cooked" headers
105 QVariant header(KnownHeaders header) const;
106 void setHeader(KnownHeaders header, const QVariant &value);
107
108 // raw headers:
109 bool hasRawHeader(const QByteArray &headerName) const;
110 QList<QByteArray> rawHeaderList() const;
111 QByteArray rawHeader(const QByteArray &headerName) const;
112 void setRawHeader(const QByteArray &headerName, const QByteArray &value);
113
114 // attributes
115 QVariant attribute(Attribute code, const QVariant &defaultValue = QVariant()) const;
116 void setAttribute(Attribute code, const QVariant &value);
117
118#ifndef QT_NO_OPENSSL
119 QSslConfiguration sslConfiguration() const;
120 void setSslConfiguration(const QSslConfiguration &configuration);
121#endif
122
123 void setOriginatingObject(QObject *object);
124 QObject *originatingObject() const;
125
126private:
127 QSharedDataPointer<QNetworkRequestPrivate> d;
128 friend class QNetworkRequestPrivate;
129};
130
131QT_END_NAMESPACE
132
133Q_DECLARE_METATYPE(QNetworkRequest)
134
135QT_END_HEADER
136
137#endif
Note: See TracBrowser for help on using the repository browser.