7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/auto/cmake/cmake.pro:
--------------------------------------------------------------------------------
1 |
2 | # Cause make to do nothing.
3 | TEMPLATE = subdirs
4 |
5 | CMAKE_QT_MODULES_UNDER_TEST = http
6 |
7 | CONFIG += ctest_testcase
8 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/webserver/cgi-bin/retrieve_testfile.cgi:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "Content-type: text/plain";
4 | echo
5 | cat testfile
6 | echo "no file retrieved" > testfile
7 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/webserver/cgi-bin/store_testfile.cgi:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "Content-type: text/plain";
4 | echo
5 | echo "file stored under 'testfile'"
6 | cat > testfile
7 |
--------------------------------------------------------------------------------
/tests/auto/headersclean/headersclean.pro:
--------------------------------------------------------------------------------
1 | QT = core testlib http
2 | include($${QT.core.sources}/../../tests/auto/other/headersclean/headersclean.pri)
3 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
4 |
--------------------------------------------------------------------------------
/tests/auto/cmake/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | cmake_minimum_required(VERSION 2.8)
3 |
4 | project(qmake_cmake_files)
5 |
6 | enable_testing()
7 |
8 | find_package(Qt5Core REQUIRED)
9 |
10 | include("${_Qt5CTestMacros}")
11 |
12 | test_module_includes(
13 | Http QHttp
14 | )
15 |
--------------------------------------------------------------------------------
/src/qhttp/qhttp.pro:
--------------------------------------------------------------------------------
1 | load(qt_build_config)
2 |
3 | TARGET = QtHttp
4 | CONFIG += static
5 | CONFIG -= shared
6 | QT = core network
7 |
8 | MODULE_PRI = ../../modules/qt_http.pri
9 | MODULE = http
10 |
11 | load(qt_module)
12 |
13 | # Input
14 | HEADERS += qhttp.h qringbuffer_p.h qhttpauthenticator_p.h
15 | SOURCES += qhttp.cpp qhttpauthenticator.cpp
16 |
--------------------------------------------------------------------------------
/modules/qt_http.pri:
--------------------------------------------------------------------------------
1 | QT.http.VERSION = 5.0.0
2 | QT.http.MAJOR_VERSION = 5
3 | QT.http.MINOR_VERSION = 0
4 | QT.http.PATCH_VERSION = 0
5 |
6 | QT.http.name = QtHttp
7 | QT.http.bins = $$QT_MODULE_BIN_BASE
8 | QT.http.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtHttp
9 | QT.http.private_includes = $$QT_MODULE_INCLUDE_BASE/QtHttp/$$QT.http.VERSION
10 | QT.http.sources = $$QT_MODULE_BASE/src/qhttp
11 | QT.http.libs = $$QT_MODULE_LIB_BASE
12 | QT.http.plugins = $$QT_MODULE_PLUGIN_BASE
13 | QT.http.imports = $$QT_MODULE_IMPORT_BASE
14 | QT.http.depends = core network
15 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | This repository contains deprecated APIs which have been removed from Qt
2 |
3 | Applications are recommended to port to the supported APIs.
4 | However as some features are lost, these APIs are provided as standalone
5 | source code for applications that require removed features.
6 |
7 | Note: If you downloaded the source package from a hosting service
8 | such as Gitorious, the package does not contain the generated headers
9 | under the ./include directory. Before building, you'll need to generate
10 | them manually by running the syncqt Perl script. For example:
11 |
12 | cd qthttp
13 | /bin/syncqt.pl -version 5.1.0
14 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/qhttp.pro:
--------------------------------------------------------------------------------
1 | CONFIG += testcase
2 | SOURCES += tst_qhttp.cpp
3 | INCLUDEPATH += "../../../include"
4 |
5 | QT = core network testlib http
6 |
7 | TARGET = tst_qhttp
8 |
9 | wince*: {
10 | webFiles.files = webserver/*
11 | webFiles.path = webserver
12 | cgi.files = webserver/cgi-bin/*
13 | cgi.path = webserver/cgi-bin
14 | addFiles.files = rfc3252.txt testhtml
15 | addFiles.path = .
16 | DEPLOYMENT += addFiles webFiles cgi
17 | DEFINES += SRCDIR=\\\"\\\"
18 | } else:vxworks*: {
19 | DEFINES += SRCDIR=\\\"\\\"
20 | } else {
21 | DEFINES += SRCDIR=\\\"$$PWD/\\\"
22 | }
23 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
24 |
--------------------------------------------------------------------------------
/qthttp.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | module_qthttp_src.subdir = src
4 | module_qthttp_src.target = sub-src
5 |
6 | #There are no examples
7 | #module_qthttp_examples.subdir = examples
8 | #module_qthttp_examples.target = sub-examples
9 | #module_qthttp_examples.depends = module_qthttp_src
10 | #!contains(QT_BUILD_PARTS,examples) {
11 | # module_qthttp_examples.CONFIG += no_default_install no_default_target
12 | #}
13 |
14 | module_qthttp_tests.subdir = tests
15 | module_qthttp_tests.target = sub-tests
16 | module_qthttp_tests.depends = module_qthttp_src
17 | module_qthttp_tests.CONFIG = no_default_install
18 | !contains(QT_BUILD_PARTS,tests):module_qthttp_tests.CONFIG += no_default_target
19 |
20 | SUBDIRS += module_qthttp_src \
21 | # module_qthttp_examples \
22 | module_qthttp_tests \
23 |
24 |
--------------------------------------------------------------------------------
/sync.profile:
--------------------------------------------------------------------------------
1 | %modules = ( # path to module name map
2 | "QtHttp" => "$basedir/src/qhttp",
3 | );
4 | %moduleheaders = ( # restrict the module headers to those found in relative path
5 | );
6 | %classnames = (
7 | );
8 | %mastercontent = (
9 | "core" => "#include \n",
10 | "network" => "#include \n",
11 | );
12 | %modulepris = (
13 | "QtHttp" => "$basedir/modules/qt_http.pri",
14 | );
15 | # Module dependencies.
16 | # Every module that is required to build this module should have one entry.
17 | # Each of the module version specifiers can take one of the following values:
18 | # - A specific Git revision.
19 | # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
20 | #
21 | %dependencies = (
22 | "qtbase" => "refs/heads/master",
23 | );
24 |
--------------------------------------------------------------------------------
/LGPL_EXCEPTION.txt:
--------------------------------------------------------------------------------
1 | Digia Qt LGPL Exception version 1.1
2 |
3 | As an additional permission to the GNU Lesser General Public License version
4 | 2.1, the object code form of a "work that uses the Library" may incorporate
5 | material from a header file that is part of the Library. You may distribute
6 | such object code under terms of your choice, provided that:
7 | (i) the header files of the Library have not been modified; and
8 | (ii) the incorporated material is limited to numerical parameters, data
9 | structure layouts, accessors, macros, inline functions and
10 | templates; and
11 | (iii) you comply with the terms of Section 6 of the GNU Lesser General
12 | Public License version 2.1.
13 |
14 | Moreover, you may apply this exception to a modified version of the Library,
15 | provided that such modification does not involve copying material from the
16 | Library into the modified Library's header files unless such material is
17 | limited to (i) numerical parameters; (ii) data structure layouts;
18 | (iii) accessors; and (iv) small macros, templates and inline functions of
19 | five lines or less in length.
20 |
21 | Furthermore, you are not required to apply this additional permission to a
22 | modified version of the Library.
23 |
--------------------------------------------------------------------------------
/tests/auto/headersclean/qt_headersclean_headers.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the test suite of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef QT_HEADERSCLEAN_HEADERS
43 | #define QT_HEADERSCLEAN_HEADERS
44 |
45 | /*
46 | This file should include all the headers to be tested by the headersclean
47 | test. It may be copied and customized for each module.
48 | */
49 |
50 | #include
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/dummyserver.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the test suite of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 | // Use if you need
42 |
43 | class DummyHttpServer : public QTcpServer
44 | {
45 | Q_OBJECT
46 | public:
47 | DummyHttpServer() : phase(Header)
48 | { listen(); }
49 |
50 | protected:
51 | enum {
52 | Header,
53 | Data1,
54 | Data2,
55 | Close
56 | } phase;
57 | void incomingConnection(int socketDescriptor)
58 | {
59 | QSslSocket *socket = new QSslSocket(this);
60 | socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState);
61 | socket->ignoreSslErrors();
62 | socket->startServerEncryption();
63 | connect(socket, SIGNAL(readyRead()), SLOT(handleReadyRead()));
64 | }
65 |
66 | public slots:
67 | void handleReadyRead()
68 | {
69 | QTcpSocket *socket = static_cast(sender());
70 | socket->readAll();
71 | if (phase != Header)
72 | return;
73 |
74 | phase = Data1;
75 | static const char header[] =
76 | "HTTP/1.0 200 OK\r\n"
77 | "Date: Fri, 07 Sep 2007 12:33:18 GMT\r\n"
78 | "Server: Apache\r\n"
79 | "Expires:\r\n"
80 | "Cache-Control:\r\n"
81 | "Pragma:\r\n"
82 | "Last-Modified: Thu, 06 Sep 2007 08:52:06 +0000\r\n"
83 | "Etag: a700f59a6ccb1ad39af68d998aa36fb1\r\n"
84 | "Vary: Accept-Encoding\r\n"
85 | "Content-Length: 6560\r\n"
86 | "Connection: close\r\n"
87 | "Content-Type: text/html; charset=utf-8\r\n"
88 | "\r\n";
89 |
90 |
91 | socket->write(header, sizeof header - 1);
92 | connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(handleBytesWritten()), Qt::QueuedConnection);
93 | }
94 |
95 | void handleBytesWritten()
96 | {
97 | QTcpSocket *socket = static_cast(sender());
98 | if (socket->bytesToWrite() != 0)
99 | return;
100 |
101 | if (phase == Data1) {
102 | QByteArray data(4096, 'a');
103 | socket->write(data);
104 | phase = Data2;
105 | } else if (phase == Data2) {
106 | QByteArray data(2464, 'a');
107 | socket->write(data);
108 | phase = Close;
109 | } else {
110 | //socket->disconnectFromHost();
111 | //socket->deleteLater();
112 | }
113 | }
114 | };
115 |
--------------------------------------------------------------------------------
/src/qhttp/qhttpauthenticator_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtNetwork module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef QHTTPAUTHENTICATOR_P_H
43 | #define QHTTPAUTHENTICATOR_P_H
44 |
45 | //
46 | // W A R N I N G
47 | // -------------
48 | //
49 | // This file is not part of the Qt API. It exists purely as an
50 | // implementation detail. This header file may change from version to
51 | // version without notice, or even be removed.
52 | //
53 | // We mean it.
54 | //
55 |
56 | #include
57 | #include
58 | #include
59 | #include
60 | #include
61 |
62 | class QHttpResponseHeader;
63 |
64 | class QHttpAuthenticatorPrivate;
65 | class QUrl;
66 |
67 | class QHttpAuthenticator
68 | {
69 | public:
70 | QHttpAuthenticator();
71 | ~QHttpAuthenticator();
72 |
73 | QHttpAuthenticator(const QHttpAuthenticator &other);
74 | QHttpAuthenticator &operator=(const QHttpAuthenticator &other);
75 |
76 | bool operator==(const QHttpAuthenticator &other) const;
77 | inline bool operator!=(const QHttpAuthenticator &other) const { return !operator==(other); }
78 |
79 | QString user() const;
80 | void setUser(const QString &user);
81 |
82 | QString password() const;
83 | void setPassword(const QString &password);
84 |
85 | QString realm() const;
86 |
87 | QVariant option(const QString &opt) const;
88 | QVariantHash options() const;
89 | void setOption(const QString &opt, const QVariant &value);
90 |
91 | bool isNull() const;
92 | void detach();
93 |
94 | QHttpAuthenticator &operator=(const QAuthenticator& auth);
95 | QAuthenticator toQAuthenticator();
96 | private:
97 | friend class QHttpAuthenticatorPrivate;
98 | QHttpAuthenticatorPrivate *d;
99 | };
100 |
101 | class QHttpAuthenticatorPrivate
102 | {
103 | public:
104 | enum Method { None, Basic, Plain, Login, Ntlm, CramMd5, DigestMd5 };
105 | QHttpAuthenticatorPrivate();
106 |
107 | QAtomicInt ref;
108 | QString user;
109 | QString extractedUser;
110 | QString password;
111 | QVariantHash options;
112 | Method method;
113 | QString realm;
114 | QByteArray challenge;
115 | bool hasFailed; //credentials have been tried but rejected by server.
116 |
117 | enum Phase {
118 | Start,
119 | Phase2,
120 | Done,
121 | Invalid
122 | };
123 | Phase phase;
124 |
125 | // digest specific
126 | QByteArray cnonce;
127 | int nonceCount;
128 |
129 | // ntlm specific
130 | QString workstation;
131 | QString userDomain;
132 |
133 | QByteArray calculateResponse(const QByteArray &method, const QByteArray &path);
134 |
135 | inline static QHttpAuthenticatorPrivate *getPrivate(QHttpAuthenticator &auth) { return auth.d; }
136 | inline static const QHttpAuthenticatorPrivate *getPrivate(const QHttpAuthenticator &auth) { return auth.d; }
137 |
138 | QByteArray digestMd5Response(const QByteArray &challenge, const QByteArray &method, const QByteArray &path);
139 | static QHash parseDigestAuthenticationChallenge(const QByteArray &challenge);
140 |
141 | #ifndef QT_NO_HTTP
142 | void parseHttpResponse(const QHttpResponseHeader &, bool isProxy);
143 | #endif
144 | void parseHttpResponse(const QList >&, bool isProxy);
145 |
146 | };
147 |
148 | #endif
149 |
--------------------------------------------------------------------------------
/tests/auto/network-settings.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the test suite of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #include
43 | #ifdef QT_NETWORK_LIB
44 | #include
45 | #endif
46 |
47 | class QtNetworkSettings
48 | {
49 | public:
50 |
51 | static QString serverLocalName()
52 | {
53 | return QString("qt-test-server");
54 | }
55 | static QString serverDomainName()
56 | {
57 | return QString("qt-test-net");
58 | }
59 | static QString serverName()
60 | {
61 | return serverLocalName() + "." + serverDomainName();
62 | }
63 | static QString winServerName()
64 | {
65 | return serverName();
66 | }
67 | static QString wildcardServerName()
68 | {
69 | return "qt-test-server.wildcard.dev." + serverDomainName();
70 | }
71 |
72 | #ifdef QT_NETWORK_LIB
73 | static QHostAddress serverIP()
74 | {
75 | return QHostInfo::fromName(serverName()).addresses().first();
76 | }
77 | #endif
78 |
79 | static bool compareReplyIMAP(QByteArray const& actual)
80 | {
81 | QList expected;
82 |
83 | // Mandriva; old test server
84 | expected << QByteArray( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " )
85 | .append(QtNetworkSettings::serverName().toAscii())
86 | .append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
87 |
88 | // Ubuntu 10.04; new test server
89 | expected << QByteArray( "* OK " )
90 | .append(QtNetworkSettings::serverLocalName().toAscii())
91 | .append(" Cyrus IMAP4 v2.2.13-Debian-2.2.13-19 server ready\r\n");
92 |
93 | // Feel free to add more as needed
94 |
95 | Q_FOREACH (QByteArray const& ba, expected) {
96 | if (ba == actual) {
97 | return true;
98 | }
99 | }
100 |
101 | return false;
102 | }
103 |
104 | static bool compareReplyIMAPSSL(QByteArray const& actual)
105 | {
106 | QList expected;
107 |
108 | // Mandriva; old test server
109 | expected << QByteArray( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " )
110 | .append(QtNetworkSettings::serverName().toAscii())
111 | .append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
112 |
113 | // Ubuntu 10.04; new test server
114 | expected << QByteArray( "* OK " )
115 | .append(QtNetworkSettings::serverLocalName().toAscii())
116 | .append(" Cyrus IMAP4 v2.2.13-Debian-2.2.13-19 server ready\r\n");
117 |
118 | // Feel free to add more as needed
119 |
120 | Q_FOREACH (QByteArray const& ba, expected) {
121 | if (ba == actual) {
122 | return true;
123 | }
124 | }
125 |
126 | return false;
127 | }
128 |
129 | static bool compareReplyFtp(QByteArray const& actual)
130 | {
131 | QList expected;
132 |
133 | // A few different vsFTPd versions.
134 | // Feel free to add more as needed
135 | expected << QByteArray( "220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n" );
136 | expected << QByteArray( "220 (vsFTPd 2.2.2)\r\n221 Goodbye.\r\n" );
137 |
138 | Q_FOREACH (QByteArray const& ba, expected) {
139 | if (ba == actual) {
140 | return true;
141 | }
142 | }
143 |
144 | return false;
145 | }
146 |
147 | #ifdef QT_NETWORK_LIB
148 | static bool verifyTestNetworkSettings()
149 | {
150 | QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName());
151 | if (testServerResult.error() != QHostInfo::NoError) {
152 | qWarning() << "Could not lookup" << QtNetworkSettings::serverName();
153 | qWarning() << "Please configure the test environment!";
154 | qWarning() << "See /etc/hosts or network-settings.h";
155 | return false;
156 | }
157 | return true;
158 | }
159 | #endif
160 | };
161 |
--------------------------------------------------------------------------------
/src/qhttp/qhttp.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtNetwork module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef QHTTP_H
43 | #define QHTTP_H
44 |
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 |
51 | QT_BEGIN_HEADER
52 |
53 | class QTcpSocket;
54 | class QTimerEvent;
55 | class QIODevice;
56 | class QAuthenticator;
57 | class QNetworkProxy;
58 | class QSslError;
59 |
60 | class QHttpPrivate;
61 |
62 | class QHttpHeaderPrivate;
63 | class QHttpHeader
64 | {
65 | public:
66 | QHttpHeader();
67 | QHttpHeader(const QHttpHeader &header);
68 | QHttpHeader(const QString &str);
69 | virtual ~QHttpHeader();
70 |
71 | QHttpHeader &operator=(const QHttpHeader &h);
72 |
73 | void setValue(const QString &key, const QString &value);
74 | void setValues(const QList > &values);
75 | void addValue(const QString &key, const QString &value);
76 | QList > values() const;
77 | bool hasKey(const QString &key) const;
78 | QStringList keys() const;
79 | QString value(const QString &key) const;
80 | QStringList allValues(const QString &key) const;
81 | void removeValue(const QString &key);
82 | void removeAllValues(const QString &key);
83 |
84 | // ### Qt 5: change to qint64
85 | bool hasContentLength() const;
86 | uint contentLength() const;
87 | void setContentLength(int len);
88 |
89 | bool hasContentType() const;
90 | QString contentType() const;
91 | void setContentType(const QString &type);
92 |
93 | virtual QString toString() const;
94 | bool isValid() const;
95 |
96 | virtual int majorVersion() const = 0;
97 | virtual int minorVersion() const = 0;
98 |
99 | protected:
100 | virtual bool parseLine(const QString &line, int number);
101 | bool parse(const QString &str);
102 | void setValid(bool);
103 |
104 | QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString());
105 | QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header);
106 | QScopedPointer d_ptr;
107 |
108 | private:
109 | Q_DECLARE_PRIVATE(QHttpHeader)
110 | };
111 |
112 | class QHttpResponseHeaderPrivate;
113 | class QHttpResponseHeader : public QHttpHeader
114 | {
115 | public:
116 | QHttpResponseHeader();
117 | QHttpResponseHeader(const QHttpResponseHeader &header);
118 | QHttpResponseHeader(const QString &str);
119 | QHttpResponseHeader(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
120 | QHttpResponseHeader &operator=(const QHttpResponseHeader &header);
121 |
122 | void setStatusLine(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
123 |
124 | int statusCode() const;
125 | QString reasonPhrase() const;
126 |
127 | int majorVersion() const;
128 | int minorVersion() const;
129 |
130 | QString toString() const;
131 |
132 | protected:
133 | bool parseLine(const QString &line, int number);
134 |
135 | private:
136 | Q_DECLARE_PRIVATE(QHttpResponseHeader)
137 | friend class QHttpPrivate;
138 | };
139 |
140 | class QHttpRequestHeaderPrivate;
141 | class QHttpRequestHeader : public QHttpHeader
142 | {
143 | public:
144 | QHttpRequestHeader();
145 | QHttpRequestHeader(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
146 | QHttpRequestHeader(const QHttpRequestHeader &header);
147 | QHttpRequestHeader(const QString &str);
148 | QHttpRequestHeader &operator=(const QHttpRequestHeader &header);
149 |
150 | void setRequest(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
151 |
152 | QString method() const;
153 | QString path() const;
154 |
155 | int majorVersion() const;
156 | int minorVersion() const;
157 |
158 | QString toString() const;
159 |
160 | protected:
161 | bool parseLine(const QString &line, int number);
162 |
163 | private:
164 | Q_DECLARE_PRIVATE(QHttpRequestHeader)
165 | };
166 |
167 | class QHttp : public QObject
168 | {
169 | Q_OBJECT
170 |
171 | public:
172 | enum ConnectionMode {
173 | ConnectionModeHttp,
174 | ConnectionModeHttps
175 | };
176 |
177 | explicit QHttp(QObject *parent = 0);
178 | QHttp(const QString &hostname, quint16 port = 80, QObject *parent = 0);
179 | QHttp(const QString &hostname, ConnectionMode mode, quint16 port = 0, QObject *parent = 0);
180 | virtual ~QHttp();
181 |
182 | enum State {
183 | Unconnected,
184 | HostLookup,
185 | Connecting,
186 | Sending,
187 | Reading,
188 | Connected,
189 | Closing
190 | };
191 | enum Error {
192 | NoError,
193 | UnknownError,
194 | HostNotFound,
195 | ConnectionRefused,
196 | UnexpectedClose,
197 | InvalidResponseHeader,
198 | WrongContentLength,
199 | Aborted,
200 | AuthenticationRequiredError,
201 | ProxyAuthenticationRequiredError
202 | };
203 |
204 | int setHost(const QString &hostname, quint16 port = 80);
205 | int setHost(const QString &hostname, ConnectionMode mode, quint16 port = 0);
206 |
207 | int setSocket(QTcpSocket *socket);
208 | int setUser(const QString &username, const QString &password = QString());
209 |
210 | #ifndef QT_NO_NETWORKPROXY
211 | int setProxy(const QString &host, int port,
212 | const QString &username = QString(),
213 | const QString &password = QString());
214 | int setProxy(const QNetworkProxy &proxy);
215 | #endif
216 |
217 | int get(const QString &path, QIODevice *to=0);
218 | int post(const QString &path, QIODevice *data, QIODevice *to=0 );
219 | int post(const QString &path, const QByteArray &data, QIODevice *to=0);
220 | int head(const QString &path);
221 | int request(const QHttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0);
222 | int request(const QHttpRequestHeader &header, const QByteArray &data, QIODevice *to=0);
223 |
224 | int closeConnection();
225 | int close();
226 |
227 | qint64 bytesAvailable() const;
228 | qint64 read(char *data, qint64 maxlen);
229 | QByteArray readAll();
230 |
231 | int currentId() const;
232 | QIODevice *currentSourceDevice() const;
233 | QIODevice *currentDestinationDevice() const;
234 | QHttpRequestHeader currentRequest() const;
235 | QHttpResponseHeader lastResponse() const;
236 | bool hasPendingRequests() const;
237 | void clearPendingRequests();
238 |
239 | State state() const;
240 |
241 | Error error() const;
242 | QString errorString() const;
243 |
244 | public Q_SLOTS:
245 | void abort();
246 |
247 | #ifndef QT_NO_OPENSSL
248 | void ignoreSslErrors();
249 | #endif
250 |
251 | Q_SIGNALS:
252 | void stateChanged(int);
253 | void responseHeaderReceived(const QHttpResponseHeader &resp);
254 | void readyRead(const QHttpResponseHeader &resp);
255 |
256 | // ### Qt 5: change to qint64
257 | void dataSendProgress(int, int);
258 | void dataReadProgress(int, int);
259 |
260 | void requestStarted(int);
261 | void requestFinished(int, bool);
262 | void done(bool);
263 |
264 | #ifndef QT_NO_NETWORKPROXY
265 | void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *);
266 | #endif
267 | void authenticationRequired(const QString &hostname, quint16 port, QAuthenticator *);
268 |
269 | #ifndef QT_NO_OPENSSL
270 | void sslErrors(const QList &errors);
271 | #endif
272 |
273 | private:
274 | Q_DISABLE_COPY(QHttp)
275 | QScopedPointer d;
276 |
277 | Q_PRIVATE_SLOT(d, void _q_startNextRequest())
278 | Q_PRIVATE_SLOT(d, void _q_slotReadyRead())
279 | Q_PRIVATE_SLOT(d, void _q_slotConnected())
280 | Q_PRIVATE_SLOT(d, void _q_slotError(QAbstractSocket::SocketError))
281 | Q_PRIVATE_SLOT(d, void _q_slotClosed())
282 | Q_PRIVATE_SLOT(d, void _q_slotBytesWritten(qint64 numBytes))
283 | #ifndef QT_NO_OPENSSL
284 | Q_PRIVATE_SLOT(d, void _q_slotEncryptedBytesWritten(qint64 numBytes))
285 | #endif
286 | Q_PRIVATE_SLOT(d, void _q_slotDoFinished())
287 | Q_PRIVATE_SLOT(d, void _q_slotSendRequest())
288 | Q_PRIVATE_SLOT(d, void _q_continuePost())
289 |
290 | friend class QHttpNormalRequest;
291 | friend class QHttpSetHostRequest;
292 | friend class QHttpSetSocketRequest;
293 | friend class QHttpSetUserRequest;
294 | friend class QHttpSetProxyRequest;
295 | friend class QHttpCloseRequest;
296 | friend class QHttpPGHRequest;
297 | };
298 |
299 | QT_END_HEADER
300 |
301 | #endif // QHTTP_H
302 |
--------------------------------------------------------------------------------
/src/qhttp/qringbuffer_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtCore module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef QRINGBUFFER_P_H
43 | #define QRINGBUFFER_P_H
44 |
45 | //
46 | // W A R N I N G
47 | // -------------
48 | //
49 | // This file is not part of the Qt API. It exists for the convenience
50 | // of a number of Qt sources files. This header file may change from
51 | // version to version without notice, or even be removed.
52 | //
53 | // We mean it.
54 | //
55 |
56 | #include
57 | #include
58 |
59 | class QRingBuffer
60 | {
61 | public:
62 | inline QRingBuffer(int growth = 4096) : basicBlockSize(growth) {
63 | buffers << QByteArray();
64 | clear();
65 | }
66 |
67 | inline int nextDataBlockSize() const {
68 | return (tailBuffer == 0 ? tail : buffers.first().size()) - head;
69 | }
70 |
71 | inline const char *readPointer() const {
72 | return buffers.isEmpty() ? 0 : (buffers.first().constData() + head);
73 | }
74 |
75 | // access the bytes at a specified position
76 | // the out-variable length will contain the amount of bytes readable
77 | // from there, e.g. the amount still the same QByteArray
78 | inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const {
79 | if (buffers.isEmpty()) {
80 | length = 0;
81 | return 0;
82 | }
83 |
84 | if (pos >= bufferSize) {
85 | length = 0;
86 | return 0;
87 | }
88 |
89 | // special case: it is in the first buffer
90 | int nextDataBlockSizeValue = nextDataBlockSize();
91 | if (pos - head < nextDataBlockSizeValue) {
92 | length = nextDataBlockSizeValue - pos;
93 | return buffers.at(0).constData() + head + pos;
94 | }
95 |
96 | // special case: we only had one buffer and tried to read over it
97 | if (buffers.length() == 1) {
98 | length = 0;
99 | return 0;
100 | }
101 |
102 | // skip the first
103 | pos -= nextDataBlockSizeValue;
104 |
105 | // normal case: it is somewhere in the second to the-one-before-the-tailBuffer
106 | for (int i = 1; i < tailBuffer; i++) {
107 | if (pos >= buffers[i].size()) {
108 | pos -= buffers[i].size();
109 | continue;
110 | }
111 |
112 | length = buffers[i].length() - pos;
113 | return buffers[i].constData() + pos;
114 | }
115 |
116 | // it is in the tail buffer
117 | length = tail - pos;
118 | return buffers[tailBuffer].constData() + pos;
119 | }
120 |
121 | inline void free(int bytes) {
122 | bufferSize -= bytes;
123 | if (bufferSize < 0)
124 | bufferSize = 0;
125 |
126 | for (;;) {
127 | int nextBlockSize = nextDataBlockSize();
128 | if (bytes < nextBlockSize) {
129 | head += bytes;
130 | if (head == tail && tailBuffer == 0)
131 | head = tail = 0;
132 | break;
133 | }
134 |
135 | bytes -= nextBlockSize;
136 | if (buffers.count() == 1) {
137 | if (buffers.at(0).size() != basicBlockSize)
138 | buffers[0].resize(basicBlockSize);
139 | head = tail = 0;
140 | tailBuffer = 0;
141 | break;
142 | }
143 |
144 | buffers.removeAt(0);
145 | --tailBuffer;
146 | head = 0;
147 | }
148 |
149 | if (isEmpty())
150 | clear(); // try to minify/squeeze us
151 | }
152 |
153 | inline char *reserve(int bytes) {
154 | // if this is a fresh empty QRingBuffer
155 | if (bufferSize == 0) {
156 | buffers[0].resize(qMax(basicBlockSize, bytes));
157 | bufferSize += bytes;
158 | tail = bytes;
159 | return buffers[tailBuffer].data();
160 | }
161 |
162 | bufferSize += bytes;
163 |
164 | // if there is already enough space, simply return.
165 | if (tail + bytes <= buffers.at(tailBuffer).size()) {
166 | char *writePtr = buffers[tailBuffer].data() + tail;
167 | tail += bytes;
168 | return writePtr;
169 | }
170 |
171 | // if our buffer isn't half full yet, simply resize it.
172 | if (tail < buffers.at(tailBuffer).size() / 2) {
173 | buffers[tailBuffer].resize(tail + bytes);
174 | char *writePtr = buffers[tailBuffer].data() + tail;
175 | tail += bytes;
176 | return writePtr;
177 | }
178 |
179 | // shrink this buffer to its current size
180 | buffers[tailBuffer].resize(tail);
181 |
182 | // create a new QByteArray with the right size
183 | buffers << QByteArray();
184 | ++tailBuffer;
185 | buffers[tailBuffer].resize(qMax(basicBlockSize, bytes));
186 | tail = bytes;
187 | return buffers[tailBuffer].data();
188 | }
189 |
190 | inline void truncate(int pos) {
191 | if (pos < size())
192 | chop(size() - pos);
193 | }
194 |
195 | inline void chop(int bytes) {
196 | bufferSize -= bytes;
197 | if (bufferSize < 0)
198 | bufferSize = 0;
199 |
200 | for (;;) {
201 | // special case: head and tail are in the same buffer
202 | if (tailBuffer == 0) {
203 | tail -= bytes;
204 | if (tail <= head)
205 | tail = head = 0;
206 | return;
207 | }
208 |
209 | if (bytes <= tail) {
210 | tail -= bytes;
211 | return;
212 | }
213 |
214 | bytes -= tail;
215 | buffers.removeAt(tailBuffer);
216 |
217 | --tailBuffer;
218 | tail = buffers.at(tailBuffer).size();
219 | }
220 |
221 | if (isEmpty())
222 | clear(); // try to minify/squeeze us
223 | }
224 |
225 | inline bool isEmpty() const {
226 | return tailBuffer == 0 && tail == 0;
227 | }
228 |
229 | inline int getChar() {
230 | if (isEmpty())
231 | return -1;
232 | char c = *readPointer();
233 | free(1);
234 | return int(uchar(c));
235 | }
236 |
237 | inline void putChar(char c) {
238 | char *ptr = reserve(1);
239 | *ptr = c;
240 | }
241 |
242 | inline void ungetChar(char c) {
243 | --head;
244 | if (head < 0) {
245 | buffers.prepend(QByteArray());
246 | buffers[0].resize(basicBlockSize);
247 | head = basicBlockSize - 1;
248 | ++tailBuffer;
249 | }
250 | buffers[0][head] = c;
251 | ++bufferSize;
252 | }
253 |
254 | inline int size() const {
255 | return bufferSize;
256 | }
257 |
258 | inline void clear() {
259 | buffers.erase(buffers.begin() + 1, buffers.end());
260 | buffers[0].resize(0);
261 | buffers[0].squeeze();
262 |
263 | head = tail = 0;
264 | tailBuffer = 0;
265 | bufferSize = 0;
266 | }
267 |
268 | inline int indexOf(char c) const {
269 | int index = 0;
270 | for (int i = 0; i < buffers.size(); ++i) {
271 | int start = 0;
272 | int end = buffers.at(i).size();
273 |
274 | if (i == 0)
275 | start = head;
276 | if (i == tailBuffer)
277 | end = tail;
278 | const char *ptr = buffers.at(i).data() + start;
279 | for (int j = start; j < end; ++j) {
280 | if (*ptr++ == c)
281 | return index;
282 | ++index;
283 | }
284 | }
285 | return -1;
286 | }
287 |
288 | inline int indexOf(char c, int maxLength) const {
289 | int index = 0;
290 | int remain = qMin(size(), maxLength);
291 | for (int i = 0; remain && i < buffers.size(); ++i) {
292 | int start = 0;
293 | int end = buffers.at(i).size();
294 |
295 | if (i == 0)
296 | start = head;
297 | if (i == tailBuffer)
298 | end = tail;
299 | if (remain < end - start) {
300 | end = start + remain;
301 | remain = 0;
302 | } else {
303 | remain -= end - start;
304 | }
305 | const char *ptr = buffers.at(i).data() + start;
306 | for (int j = start; j < end; ++j) {
307 | if (*ptr++ == c)
308 | return index;
309 | ++index;
310 | }
311 | }
312 | return -1;
313 | }
314 |
315 | inline int read(char *data, int maxLength) {
316 | int bytesToRead = qMin(size(), maxLength);
317 | int readSoFar = 0;
318 | while (readSoFar < bytesToRead) {
319 | const char *ptr = readPointer();
320 | int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar, nextDataBlockSize());
321 | if (data)
322 | memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock);
323 | readSoFar += bytesToReadFromThisBlock;
324 | free(bytesToReadFromThisBlock);
325 | }
326 | return readSoFar;
327 | }
328 |
329 | inline QByteArray read(int maxLength) {
330 | QByteArray tmp;
331 | tmp.resize(qMin(maxLength, size()));
332 | read(tmp.data(), tmp.size());
333 | return tmp;
334 | }
335 |
336 | inline QByteArray readAll() {
337 | return read(size());
338 | }
339 |
340 | // read an unspecified amount (will read the first buffer)
341 | inline QByteArray read() {
342 | if (bufferSize == 0)
343 | return QByteArray();
344 |
345 | // multiple buffers, just take the first one
346 | if (head == 0 && tailBuffer != 0) {
347 | QByteArray qba = buffers.takeFirst();
348 | --tailBuffer;
349 | bufferSize -= qba.length();
350 | return qba;
351 | }
352 |
353 | // one buffer with good value for head. Just take it.
354 | if (head == 0 && tailBuffer == 0) {
355 | QByteArray qba = buffers.takeFirst();
356 | qba.resize(tail);
357 | buffers << QByteArray();
358 | bufferSize = 0;
359 | tail = 0;
360 | return qba;
361 | }
362 |
363 | // Bad case: We have to memcpy.
364 | // We can avoid by initializing the QRingBuffer with basicBlockSize of 0
365 | // and only using this read() function.
366 | QByteArray qba(readPointer(), nextDataBlockSize());
367 | buffers.removeFirst();
368 | head = 0;
369 | if (tailBuffer == 0) {
370 | buffers << QByteArray();
371 | tail = 0;
372 | } else {
373 | --tailBuffer;
374 | }
375 | bufferSize -= qba.length();
376 | return qba;
377 | }
378 |
379 | // append a new buffer to the end
380 | inline void append(const QByteArray &qba) {
381 | buffers[tailBuffer].resize(tail);
382 | buffers << qba;
383 | ++tailBuffer;
384 | tail = qba.length();
385 | bufferSize += qba.length();
386 | }
387 |
388 | inline QByteArray peek(int maxLength) const {
389 | int bytesToRead = qMin(size(), maxLength);
390 | if(maxLength <= 0)
391 | return QByteArray();
392 | QByteArray ret;
393 | ret.resize(bytesToRead);
394 | int readSoFar = 0;
395 | for (int i = 0; readSoFar < bytesToRead && i < buffers.size(); ++i) {
396 | int start = 0;
397 | int end = buffers.at(i).size();
398 | if (i == 0)
399 | start = head;
400 | if (i == tailBuffer)
401 | end = tail;
402 | const int len = qMin(ret.size()-readSoFar, end-start);
403 | memcpy(ret.data()+readSoFar, buffers.at(i).constData()+start, len);
404 | readSoFar += len;
405 | }
406 | Q_ASSERT(readSoFar == ret.size());
407 | return ret;
408 | }
409 |
410 | inline int skip(int length) {
411 | return read(0, length);
412 | }
413 |
414 | inline int readLine(char *data, int maxLength) {
415 | int index = indexOf('\n');
416 | if (index == -1)
417 | return read(data, maxLength);
418 | if (maxLength <= 0)
419 | return -1;
420 |
421 | int readSoFar = 0;
422 | while (readSoFar < index + 1 && readSoFar < maxLength - 1) {
423 | int bytesToRead = qMin((index + 1) - readSoFar, nextDataBlockSize());
424 | bytesToRead = qMin(bytesToRead, (maxLength - 1) - readSoFar);
425 | memcpy(data + readSoFar, readPointer(), bytesToRead);
426 | readSoFar += bytesToRead;
427 | free(bytesToRead);
428 | }
429 |
430 | // Terminate it.
431 | data[readSoFar] = '\0';
432 | return readSoFar;
433 | }
434 |
435 | inline bool canReadLine() const {
436 | return indexOf('\n') != -1;
437 | }
438 |
439 | private:
440 | QList buffers;
441 | int head, tail;
442 | int tailBuffer; // always buffers.size() - 1
443 | int basicBlockSize;
444 | int bufferSize;
445 | };
446 |
447 | #endif // QRINGBUFFER_P_H
448 |
--------------------------------------------------------------------------------
/LICENSE.FDL:
--------------------------------------------------------------------------------
1 | GNU Free Documentation License
2 | Version 1.3, 3 November 2008
3 |
4 |
5 | Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
6 |
7 | Everyone is permitted to copy and distribute verbatim copies
8 | of this license document, but changing it is not allowed.
9 |
10 | 0. PREAMBLE
11 |
12 | The purpose of this License is to make a manual, textbook, or other
13 | functional and useful document "free" in the sense of freedom: to
14 | assure everyone the effective freedom to copy and redistribute it,
15 | with or without modifying it, either commercially or noncommercially.
16 | Secondarily, this License preserves for the author and publisher a way
17 | to get credit for their work, while not being considered responsible
18 | for modifications made by others.
19 |
20 | This License is a kind of "copyleft", which means that derivative
21 | works of the document must themselves be free in the same sense. It
22 | complements the GNU General Public License, which is a copyleft
23 | license designed for free software.
24 |
25 | We have designed this License in order to use it for manuals for free
26 | software, because free software needs free documentation: a free
27 | program should come with manuals providing the same freedoms that the
28 | software does. But this License is not limited to software manuals;
29 | it can be used for any textual work, regardless of subject matter or
30 | whether it is published as a printed book. We recommend this License
31 | principally for works whose purpose is instruction or reference.
32 |
33 |
34 | 1. APPLICABILITY AND DEFINITIONS
35 |
36 | This License applies to any manual or other work, in any medium, that
37 | contains a notice placed by the copyright holder saying it can be
38 | distributed under the terms of this License. Such a notice grants a
39 | world-wide, royalty-free license, unlimited in duration, to use that
40 | work under the conditions stated herein. The "Document", below,
41 | refers to any such manual or work. Any member of the public is a
42 | licensee, and is addressed as "you". You accept the license if you
43 | copy, modify or distribute the work in a way requiring permission
44 | under copyright law.
45 |
46 | A "Modified Version" of the Document means any work containing the
47 | Document or a portion of it, either copied verbatim, or with
48 | modifications and/or translated into another language.
49 |
50 | A "Secondary Section" is a named appendix or a front-matter section of
51 | the Document that deals exclusively with the relationship of the
52 | publishers or authors of the Document to the Document's overall
53 | subject (or to related matters) and contains nothing that could fall
54 | directly within that overall subject. (Thus, if the Document is in
55 | part a textbook of mathematics, a Secondary Section may not explain
56 | any mathematics.) The relationship could be a matter of historical
57 | connection with the subject or with related matters, or of legal,
58 | commercial, philosophical, ethical or political position regarding
59 | them.
60 |
61 | The "Invariant Sections" are certain Secondary Sections whose titles
62 | are designated, as being those of Invariant Sections, in the notice
63 | that says that the Document is released under this License. If a
64 | section does not fit the above definition of Secondary then it is not
65 | allowed to be designated as Invariant. The Document may contain zero
66 | Invariant Sections. If the Document does not identify any Invariant
67 | Sections then there are none.
68 |
69 | The "Cover Texts" are certain short passages of text that are listed,
70 | as Front-Cover Texts or Back-Cover Texts, in the notice that says that
71 | the Document is released under this License. A Front-Cover Text may
72 | be at most 5 words, and a Back-Cover Text may be at most 25 words.
73 |
74 | A "Transparent" copy of the Document means a machine-readable copy,
75 | represented in a format whose specification is available to the
76 | general public, that is suitable for revising the document
77 | straightforwardly with generic text editors or (for images composed of
78 | pixels) generic paint programs or (for drawings) some widely available
79 | drawing editor, and that is suitable for input to text formatters or
80 | for automatic translation to a variety of formats suitable for input
81 | to text formatters. A copy made in an otherwise Transparent file
82 | format whose markup, or absence of markup, has been arranged to thwart
83 | or discourage subsequent modification by readers is not Transparent.
84 | An image format is not Transparent if used for any substantial amount
85 | of text. A copy that is not "Transparent" is called "Opaque".
86 |
87 | Examples of suitable formats for Transparent copies include plain
88 | ASCII without markup, Texinfo input format, LaTeX input format, SGML
89 | or XML using a publicly available DTD, and standard-conforming simple
90 | HTML, PostScript or PDF designed for human modification. Examples of
91 | transparent image formats include PNG, XCF and JPG. Opaque formats
92 | include proprietary formats that can be read and edited only by
93 | proprietary word processors, SGML or XML for which the DTD and/or
94 | processing tools are not generally available, and the
95 | machine-generated HTML, PostScript or PDF produced by some word
96 | processors for output purposes only.
97 |
98 | The "Title Page" means, for a printed book, the title page itself,
99 | plus such following pages as are needed to hold, legibly, the material
100 | this License requires to appear in the title page. For works in
101 | formats which do not have any title page as such, "Title Page" means
102 | the text near the most prominent appearance of the work's title,
103 | preceding the beginning of the body of the text.
104 |
105 | The "publisher" means any person or entity that distributes copies of
106 | the Document to the public.
107 |
108 | A section "Entitled XYZ" means a named subunit of the Document whose
109 | title either is precisely XYZ or contains XYZ in parentheses following
110 | text that translates XYZ in another language. (Here XYZ stands for a
111 | specific section name mentioned below, such as "Acknowledgements",
112 | "Dedications", "Endorsements", or "History".) To "Preserve the Title"
113 | of such a section when you modify the Document means that it remains a
114 | section "Entitled XYZ" according to this definition.
115 |
116 | The Document may include Warranty Disclaimers next to the notice which
117 | states that this License applies to the Document. These Warranty
118 | Disclaimers are considered to be included by reference in this
119 | License, but only as regards disclaiming warranties: any other
120 | implication that these Warranty Disclaimers may have is void and has
121 | no effect on the meaning of this License.
122 |
123 | 2. VERBATIM COPYING
124 |
125 | You may copy and distribute the Document in any medium, either
126 | commercially or noncommercially, provided that this License, the
127 | copyright notices, and the license notice saying this License applies
128 | to the Document are reproduced in all copies, and that you add no
129 | other conditions whatsoever to those of this License. You may not use
130 | technical measures to obstruct or control the reading or further
131 | copying of the copies you make or distribute. However, you may accept
132 | compensation in exchange for copies. If you distribute a large enough
133 | number of copies you must also follow the conditions in section 3.
134 |
135 | You may also lend copies, under the same conditions stated above, and
136 | you may publicly display copies.
137 |
138 |
139 | 3. COPYING IN QUANTITY
140 |
141 | If you publish printed copies (or copies in media that commonly have
142 | printed covers) of the Document, numbering more than 100, and the
143 | Document's license notice requires Cover Texts, you must enclose the
144 | copies in covers that carry, clearly and legibly, all these Cover
145 | Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
146 | the back cover. Both covers must also clearly and legibly identify
147 | you as the publisher of these copies. The front cover must present
148 | the full title with all words of the title equally prominent and
149 | visible. You may add other material on the covers in addition.
150 | Copying with changes limited to the covers, as long as they preserve
151 | the title of the Document and satisfy these conditions, can be treated
152 | as verbatim copying in other respects.
153 |
154 | If the required texts for either cover are too voluminous to fit
155 | legibly, you should put the first ones listed (as many as fit
156 | reasonably) on the actual cover, and continue the rest onto adjacent
157 | pages.
158 |
159 | If you publish or distribute Opaque copies of the Document numbering
160 | more than 100, you must either include a machine-readable Transparent
161 | copy along with each Opaque copy, or state in or with each Opaque copy
162 | a computer-network location from which the general network-using
163 | public has access to download using public-standard network protocols
164 | a complete Transparent copy of the Document, free of added material.
165 | If you use the latter option, you must take reasonably prudent steps,
166 | when you begin distribution of Opaque copies in quantity, to ensure
167 | that this Transparent copy will remain thus accessible at the stated
168 | location until at least one year after the last time you distribute an
169 | Opaque copy (directly or through your agents or retailers) of that
170 | edition to the public.
171 |
172 | It is requested, but not required, that you contact the authors of the
173 | Document well before redistributing any large number of copies, to
174 | give them a chance to provide you with an updated version of the
175 | Document.
176 |
177 |
178 | 4. MODIFICATIONS
179 |
180 | You may copy and distribute a Modified Version of the Document under
181 | the conditions of sections 2 and 3 above, provided that you release
182 | the Modified Version under precisely this License, with the Modified
183 | Version filling the role of the Document, thus licensing distribution
184 | and modification of the Modified Version to whoever possesses a copy
185 | of it. In addition, you must do these things in the Modified Version:
186 |
187 | A. Use in the Title Page (and on the covers, if any) a title distinct
188 | from that of the Document, and from those of previous versions
189 | (which should, if there were any, be listed in the History section
190 | of the Document). You may use the same title as a previous version
191 | if the original publisher of that version gives permission.
192 | B. List on the Title Page, as authors, one or more persons or entities
193 | responsible for authorship of the modifications in the Modified
194 | Version, together with at least five of the principal authors of the
195 | Document (all of its principal authors, if it has fewer than five),
196 | unless they release you from this requirement.
197 | C. State on the Title page the name of the publisher of the
198 | Modified Version, as the publisher.
199 | D. Preserve all the copyright notices of the Document.
200 | E. Add an appropriate copyright notice for your modifications
201 | adjacent to the other copyright notices.
202 | F. Include, immediately after the copyright notices, a license notice
203 | giving the public permission to use the Modified Version under the
204 | terms of this License, in the form shown in the Addendum below.
205 | G. Preserve in that license notice the full lists of Invariant Sections
206 | and required Cover Texts given in the Document's license notice.
207 | H. Include an unaltered copy of this License.
208 | I. Preserve the section Entitled "History", Preserve its Title, and add
209 | to it an item stating at least the title, year, new authors, and
210 | publisher of the Modified Version as given on the Title Page. If
211 | there is no section Entitled "History" in the Document, create one
212 | stating the title, year, authors, and publisher of the Document as
213 | given on its Title Page, then add an item describing the Modified
214 | Version as stated in the previous sentence.
215 | J. Preserve the network location, if any, given in the Document for
216 | public access to a Transparent copy of the Document, and likewise
217 | the network locations given in the Document for previous versions
218 | it was based on. These may be placed in the "History" section.
219 | You may omit a network location for a work that was published at
220 | least four years before the Document itself, or if the original
221 | publisher of the version it refers to gives permission.
222 | K. For any section Entitled "Acknowledgements" or "Dedications",
223 | Preserve the Title of the section, and preserve in the section all
224 | the substance and tone of each of the contributor acknowledgements
225 | and/or dedications given therein.
226 | L. Preserve all the Invariant Sections of the Document,
227 | unaltered in their text and in their titles. Section numbers
228 | or the equivalent are not considered part of the section titles.
229 | M. Delete any section Entitled "Endorsements". Such a section
230 | may not be included in the Modified Version.
231 | N. Do not retitle any existing section to be Entitled "Endorsements"
232 | or to conflict in title with any Invariant Section.
233 | O. Preserve any Warranty Disclaimers.
234 |
235 | If the Modified Version includes new front-matter sections or
236 | appendices that qualify as Secondary Sections and contain no material
237 | copied from the Document, you may at your option designate some or all
238 | of these sections as invariant. To do this, add their titles to the
239 | list of Invariant Sections in the Modified Version's license notice.
240 | These titles must be distinct from any other section titles.
241 |
242 | You may add a section Entitled "Endorsements", provided it contains
243 | nothing but endorsements of your Modified Version by various
244 | parties--for example, statements of peer review or that the text has
245 | been approved by an organization as the authoritative definition of a
246 | standard.
247 |
248 | You may add a passage of up to five words as a Front-Cover Text, and a
249 | passage of up to 25 words as a Back-Cover Text, to the end of the list
250 | of Cover Texts in the Modified Version. Only one passage of
251 | Front-Cover Text and one of Back-Cover Text may be added by (or
252 | through arrangements made by) any one entity. If the Document already
253 | includes a cover text for the same cover, previously added by you or
254 | by arrangement made by the same entity you are acting on behalf of,
255 | you may not add another; but you may replace the old one, on explicit
256 | permission from the previous publisher that added the old one.
257 |
258 | The author(s) and publisher(s) of the Document do not by this License
259 | give permission to use their names for publicity for or to assert or
260 | imply endorsement of any Modified Version.
261 |
262 |
263 | 5. COMBINING DOCUMENTS
264 |
265 | You may combine the Document with other documents released under this
266 | License, under the terms defined in section 4 above for modified
267 | versions, provided that you include in the combination all of the
268 | Invariant Sections of all of the original documents, unmodified, and
269 | list them all as Invariant Sections of your combined work in its
270 | license notice, and that you preserve all their Warranty Disclaimers.
271 |
272 | The combined work need only contain one copy of this License, and
273 | multiple identical Invariant Sections may be replaced with a single
274 | copy. If there are multiple Invariant Sections with the same name but
275 | different contents, make the title of each such section unique by
276 | adding at the end of it, in parentheses, the name of the original
277 | author or publisher of that section if known, or else a unique number.
278 | Make the same adjustment to the section titles in the list of
279 | Invariant Sections in the license notice of the combined work.
280 |
281 | In the combination, you must combine any sections Entitled "History"
282 | in the various original documents, forming one section Entitled
283 | "History"; likewise combine any sections Entitled "Acknowledgements",
284 | and any sections Entitled "Dedications". You must delete all sections
285 | Entitled "Endorsements".
286 |
287 |
288 | 6. COLLECTIONS OF DOCUMENTS
289 |
290 | You may make a collection consisting of the Document and other
291 | documents released under this License, and replace the individual
292 | copies of this License in the various documents with a single copy
293 | that is included in the collection, provided that you follow the rules
294 | of this License for verbatim copying of each of the documents in all
295 | other respects.
296 |
297 | You may extract a single document from such a collection, and
298 | distribute it individually under this License, provided you insert a
299 | copy of this License into the extracted document, and follow this
300 | License in all other respects regarding verbatim copying of that
301 | document.
302 |
303 |
304 | 7. AGGREGATION WITH INDEPENDENT WORKS
305 |
306 | A compilation of the Document or its derivatives with other separate
307 | and independent documents or works, in or on a volume of a storage or
308 | distribution medium, is called an "aggregate" if the copyright
309 | resulting from the compilation is not used to limit the legal rights
310 | of the compilation's users beyond what the individual works permit.
311 | When the Document is included in an aggregate, this License does not
312 | apply to the other works in the aggregate which are not themselves
313 | derivative works of the Document.
314 |
315 | If the Cover Text requirement of section 3 is applicable to these
316 | copies of the Document, then if the Document is less than one half of
317 | the entire aggregate, the Document's Cover Texts may be placed on
318 | covers that bracket the Document within the aggregate, or the
319 | electronic equivalent of covers if the Document is in electronic form.
320 | Otherwise they must appear on printed covers that bracket the whole
321 | aggregate.
322 |
323 |
324 | 8. TRANSLATION
325 |
326 | Translation is considered a kind of modification, so you may
327 | distribute translations of the Document under the terms of section 4.
328 | Replacing Invariant Sections with translations requires special
329 | permission from their copyright holders, but you may include
330 | translations of some or all Invariant Sections in addition to the
331 | original versions of these Invariant Sections. You may include a
332 | translation of this License, and all the license notices in the
333 | Document, and any Warranty Disclaimers, provided that you also include
334 | the original English version of this License and the original versions
335 | of those notices and disclaimers. In case of a disagreement between
336 | the translation and the original version of this License or a notice
337 | or disclaimer, the original version will prevail.
338 |
339 | If a section in the Document is Entitled "Acknowledgements",
340 | "Dedications", or "History", the requirement (section 4) to Preserve
341 | its Title (section 1) will typically require changing the actual
342 | title.
343 |
344 |
345 | 9. TERMINATION
346 |
347 | You may not copy, modify, sublicense, or distribute the Document
348 | except as expressly provided under this License. Any attempt
349 | otherwise to copy, modify, sublicense, or distribute it is void, and
350 | will automatically terminate your rights under this License.
351 |
352 | However, if you cease all violation of this License, then your license
353 | from a particular copyright holder is reinstated (a) provisionally,
354 | unless and until the copyright holder explicitly and finally
355 | terminates your license, and (b) permanently, if the copyright holder
356 | fails to notify you of the violation by some reasonable means prior to
357 | 60 days after the cessation.
358 |
359 | Moreover, your license from a particular copyright holder is
360 | reinstated permanently if the copyright holder notifies you of the
361 | violation by some reasonable means, this is the first time you have
362 | received notice of violation of this License (for any work) from that
363 | copyright holder, and you cure the violation prior to 30 days after
364 | your receipt of the notice.
365 |
366 | Termination of your rights under this section does not terminate the
367 | licenses of parties who have received copies or rights from you under
368 | this License. If your rights have been terminated and not permanently
369 | reinstated, receipt of a copy of some or all of the same material does
370 | not give you any rights to use it.
371 |
372 |
373 | 10. FUTURE REVISIONS OF THIS LICENSE
374 |
375 | The Free Software Foundation may publish new, revised versions of the
376 | GNU Free Documentation License from time to time. Such new versions
377 | will be similar in spirit to the present version, but may differ in
378 | detail to address new problems or concerns. See
379 | http://www.gnu.org/copyleft/.
380 |
381 | Each version of the License is given a distinguishing version number.
382 | If the Document specifies that a particular numbered version of this
383 | License "or any later version" applies to it, you have the option of
384 | following the terms and conditions either of that specified version or
385 | of any later version that has been published (not as a draft) by the
386 | Free Software Foundation. If the Document does not specify a version
387 | number of this License, you may choose any version ever published (not
388 | as a draft) by the Free Software Foundation. If the Document
389 | specifies that a proxy can decide which future versions of this
390 | License can be used, that proxy's public statement of acceptance of a
391 | version permanently authorizes you to choose that version for the
392 | Document.
393 |
394 | 11. RELICENSING
395 |
396 | "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
397 | World Wide Web server that publishes copyrightable works and also
398 | provides prominent facilities for anybody to edit those works. A
399 | public wiki that anybody can edit is an example of such a server. A
400 | "Massive Multiauthor Collaboration" (or "MMC") contained in the site
401 | means any set of copyrightable works thus published on the MMC site.
402 |
403 | "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
404 | license published by Creative Commons Corporation, a not-for-profit
405 | corporation with a principal place of business in San Francisco,
406 | California, as well as future copyleft versions of that license
407 | published by that same organization.
408 |
409 | "Incorporate" means to publish or republish a Document, in whole or in
410 | part, as part of another Document.
411 |
412 | An MMC is "eligible for relicensing" if it is licensed under this
413 | License, and if all works that were first published under this License
414 | somewhere other than this MMC, and subsequently incorporated in whole or
415 | in part into the MMC, (1) had no cover texts or invariant sections, and
416 | (2) were thus incorporated prior to November 1, 2008.
417 |
418 | The operator of an MMC Site may republish an MMC contained in the site
419 | under CC-BY-SA on the same site at any time before August 1, 2009,
420 | provided the MMC is eligible for relicensing.
421 |
422 |
423 | ADDENDUM: How to use this License for your documents
424 |
425 | To use this License in a document you have written, include a copy of
426 | the License in the document and put the following copyright and
427 | license notices just after the title page:
428 |
429 | Copyright (c) YEAR YOUR NAME.
430 | Permission is granted to copy, distribute and/or modify this document
431 | under the terms of the GNU Free Documentation License, Version 1.3
432 | or any later version published by the Free Software Foundation;
433 | with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
434 | A copy of the license is included in the section entitled "GNU
435 | Free Documentation License".
436 |
437 | If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
438 | replace the "with...Texts." line with this:
439 |
440 | with the Invariant Sections being LIST THEIR TITLES, with the
441 | Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
442 |
443 | If you have Invariant Sections without Cover Texts, or some other
444 | combination of the three, merge those two alternatives to suit the
445 | situation.
446 |
447 | If your document contains nontrivial examples of program code, we
448 | recommend releasing these examples in parallel under your choice of
449 | free software license, such as the GNU General Public License,
450 | to permit their use in free software.
451 |
--------------------------------------------------------------------------------
/LICENSE.LGPL:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 |
3 | The Qt Toolkit is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | Contact: http://www.qt-project.org/legal
5 |
6 | You may use, distribute and copy the Qt GUI Toolkit under the terms of
7 | GNU Lesser General Public License version 2.1, which is displayed below.
8 |
9 | -------------------------------------------------------------------------
10 |
11 | GNU LESSER GENERAL PUBLIC LICENSE
12 | Version 2.1, February 1999
13 |
14 | Copyright (C) 1991, 1999 Free Software Foundation, Inc.
15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 | Everyone is permitted to copy and distribute verbatim copies
17 | of this license document, but changing it is not allowed.
18 |
19 | [This is the first released version of the Lesser GPL. It also counts
20 | as the successor of the GNU Library Public License, version 2, hence
21 | the version number 2.1.]
22 |
23 | Preamble
24 |
25 | The licenses for most software are designed to take away your
26 | freedom to share and change it. By contrast, the GNU General Public
27 | Licenses are intended to guarantee your freedom to share and change
28 | free software--to make sure the software is free for all its users.
29 |
30 | This license, the Lesser General Public License, applies to some
31 | specially designated software packages--typically libraries--of the
32 | Free Software Foundation and other authors who decide to use it. You
33 | can use it too, but we suggest you first think carefully about whether
34 | this license or the ordinary General Public License is the better
35 | strategy to use in any particular case, based on the explanations below.
36 |
37 | When we speak of free software, we are referring to freedom of use,
38 | not price. Our General Public Licenses are designed to make sure that
39 | you have the freedom to distribute copies of free software (and charge
40 | for this service if you wish); that you receive source code or can get
41 | it if you want it; that you can change the software and use pieces of
42 | it in new free programs; and that you are informed that you can do
43 | these things.
44 |
45 | To protect your rights, we need to make restrictions that forbid
46 | distributors to deny you these rights or to ask you to surrender these
47 | rights. These restrictions translate to certain responsibilities for
48 | you if you distribute copies of the library or if you modify it.
49 |
50 | For example, if you distribute copies of the library, whether gratis
51 | or for a fee, you must give the recipients all the rights that we gave
52 | you. You must make sure that they, too, receive or can get the source
53 | code. If you link other code with the library, you must provide
54 | complete object files to the recipients, so that they can relink them
55 | with the library after making changes to the library and recompiling
56 | it. And you must show them these terms so they know their rights.
57 |
58 | We protect your rights with a two-step method: (1) we copyright the
59 | library, and (2) we offer you this license, which gives you legal
60 | permission to copy, distribute and/or modify the library.
61 |
62 | To protect each distributor, we want to make it very clear that
63 | there is no warranty for the free library. Also, if the library is
64 | modified by someone else and passed on, the recipients should know
65 | that what they have is not the original version, so that the original
66 | author's reputation will not be affected by problems that might be
67 | introduced by others.
68 |
69 | Finally, software patents pose a constant threat to the existence of
70 | any free program. We wish to make sure that a company cannot
71 | effectively restrict the users of a free program by obtaining a
72 | restrictive license from a patent holder. Therefore, we insist that
73 | any patent license obtained for a version of the library must be
74 | consistent with the full freedom of use specified in this license.
75 |
76 | Most GNU software, including some libraries, is covered by the
77 | ordinary GNU General Public License. This license, the GNU Lesser
78 | General Public License, applies to certain designated libraries, and
79 | is quite different from the ordinary General Public License. We use
80 | this license for certain libraries in order to permit linking those
81 | libraries into non-free programs.
82 |
83 | When a program is linked with a library, whether statically or using
84 | a shared library, the combination of the two is legally speaking a
85 | combined work, a derivative of the original library. The ordinary
86 | General Public License therefore permits such linking only if the
87 | entire combination fits its criteria of freedom. The Lesser General
88 | Public License permits more lax criteria for linking other code with
89 | the library.
90 |
91 | We call this license the "Lesser" General Public License because it
92 | does Less to protect the user's freedom than the ordinary General
93 | Public License. It also provides other free software developers Less
94 | of an advantage over competing non-free programs. These disadvantages
95 | are the reason we use the ordinary General Public License for many
96 | libraries. However, the Lesser license provides advantages in certain
97 | special circumstances.
98 |
99 | For example, on rare occasions, there may be a special need to
100 | encourage the widest possible use of a certain library, so that it becomes
101 | a de-facto standard. To achieve this, non-free programs must be
102 | allowed to use the library. A more frequent case is that a free
103 | library does the same job as widely used non-free libraries. In this
104 | case, there is little to gain by limiting the free library to free
105 | software only, so we use the Lesser General Public License.
106 |
107 | In other cases, permission to use a particular library in non-free
108 | programs enables a greater number of people to use a large body of
109 | free software. For example, permission to use the GNU C Library in
110 | non-free programs enables many more people to use the whole GNU
111 | operating system, as well as its variant, the GNU/Linux operating
112 | system.
113 |
114 | Although the Lesser General Public License is Less protective of the
115 | users' freedom, it does ensure that the user of a program that is
116 | linked with the Library has the freedom and the wherewithal to run
117 | that program using a modified version of the Library.
118 |
119 | The precise terms and conditions for copying, distribution and
120 | modification follow. Pay close attention to the difference between a
121 | "work based on the library" and a "work that uses the library". The
122 | former contains code derived from the library, whereas the latter must
123 | be combined with the library in order to run.
124 |
125 | GNU LESSER GENERAL PUBLIC LICENSE
126 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
127 |
128 | 0. This License Agreement applies to any software library or other
129 | program which contains a notice placed by the copyright holder or
130 | other authorized party saying it may be distributed under the terms of
131 | this Lesser General Public License (also called "this License").
132 | Each licensee is addressed as "you".
133 |
134 | A "library" means a collection of software functions and/or data
135 | prepared so as to be conveniently linked with application programs
136 | (which use some of those functions and data) to form executables.
137 |
138 | The "Library", below, refers to any such software library or work
139 | which has been distributed under these terms. A "work based on the
140 | Library" means either the Library or any derivative work under
141 | copyright law: that is to say, a work containing the Library or a
142 | portion of it, either verbatim or with modifications and/or translated
143 | straightforwardly into another language. (Hereinafter, translation is
144 | included without limitation in the term "modification".)
145 |
146 | "Source code" for a work means the preferred form of the work for
147 | making modifications to it. For a library, complete source code means
148 | all the source code for all modules it contains, plus any associated
149 | interface definition files, plus the scripts used to control compilation
150 | and installation of the library.
151 |
152 | Activities other than copying, distribution and modification are not
153 | covered by this License; they are outside its scope. The act of
154 | running a program using the Library is not restricted, and output from
155 | such a program is covered only if its contents constitute a work based
156 | on the Library (independent of the use of the Library in a tool for
157 | writing it). Whether that is true depends on what the Library does
158 | and what the program that uses the Library does.
159 |
160 | 1. You may copy and distribute verbatim copies of the Library's
161 | complete source code as you receive it, in any medium, provided that
162 | you conspicuously and appropriately publish on each copy an
163 | appropriate copyright notice and disclaimer of warranty; keep intact
164 | all the notices that refer to this License and to the absence of any
165 | warranty; and distribute a copy of this License along with the
166 | Library.
167 |
168 | You may charge a fee for the physical act of transferring a copy,
169 | and you may at your option offer warranty protection in exchange for a
170 | fee.
171 |
172 | 2. You may modify your copy or copies of the Library or any portion
173 | of it, thus forming a work based on the Library, and copy and
174 | distribute such modifications or work under the terms of Section 1
175 | above, provided that you also meet all of these conditions:
176 |
177 | a) The modified work must itself be a software library.
178 |
179 | b) You must cause the files modified to carry prominent notices
180 | stating that you changed the files and the date of any change.
181 |
182 | c) You must cause the whole of the work to be licensed at no
183 | charge to all third parties under the terms of this License.
184 |
185 | d) If a facility in the modified Library refers to a function or a
186 | table of data to be supplied by an application program that uses
187 | the facility, other than as an argument passed when the facility
188 | is invoked, then you must make a good faith effort to ensure that,
189 | in the event an application does not supply such function or
190 | table, the facility still operates, and performs whatever part of
191 | its purpose remains meaningful.
192 |
193 | (For example, a function in a library to compute square roots has
194 | a purpose that is entirely well-defined independent of the
195 | application. Therefore, Subsection 2d requires that any
196 | application-supplied function or table used by this function must
197 | be optional: if the application does not supply it, the square
198 | root function must still compute square roots.)
199 |
200 | These requirements apply to the modified work as a whole. If
201 | identifiable sections of that work are not derived from the Library,
202 | and can be reasonably considered independent and separate works in
203 | themselves, then this License, and its terms, do not apply to those
204 | sections when you distribute them as separate works. But when you
205 | distribute the same sections as part of a whole which is a work based
206 | on the Library, the distribution of the whole must be on the terms of
207 | this License, whose permissions for other licensees extend to the
208 | entire whole, and thus to each and every part regardless of who wrote
209 | it.
210 |
211 | Thus, it is not the intent of this section to claim rights or contest
212 | your rights to work written entirely by you; rather, the intent is to
213 | exercise the right to control the distribution of derivative or
214 | collective works based on the Library.
215 |
216 | In addition, mere aggregation of another work not based on the Library
217 | with the Library (or with a work based on the Library) on a volume of
218 | a storage or distribution medium does not bring the other work under
219 | the scope of this License.
220 |
221 | 3. You may opt to apply the terms of the ordinary GNU General Public
222 | License instead of this License to a given copy of the Library. To do
223 | this, you must alter all the notices that refer to this License, so
224 | that they refer to the ordinary GNU General Public License, version 2,
225 | instead of to this License. (If a newer version than version 2 of the
226 | ordinary GNU General Public License has appeared, then you can specify
227 | that version instead if you wish.) Do not make any other change in
228 | these notices.
229 |
230 | Once this change is made in a given copy, it is irreversible for
231 | that copy, so the ordinary GNU General Public License applies to all
232 | subsequent copies and derivative works made from that copy.
233 |
234 | This option is useful when you wish to copy part of the code of
235 | the Library into a program that is not a library.
236 |
237 | 4. You may copy and distribute the Library (or a portion or
238 | derivative of it, under Section 2) in object code or executable form
239 | under the terms of Sections 1 and 2 above provided that you accompany
240 | it with the complete corresponding machine-readable source code, which
241 | must be distributed under the terms of Sections 1 and 2 above on a
242 | medium customarily used for software interchange.
243 |
244 | If distribution of object code is made by offering access to copy
245 | from a designated place, then offering equivalent access to copy the
246 | source code from the same place satisfies the requirement to
247 | distribute the source code, even though third parties are not
248 | compelled to copy the source along with the object code.
249 |
250 | 5. A program that contains no derivative of any portion of the
251 | Library, but is designed to work with the Library by being compiled or
252 | linked with it, is called a "work that uses the Library". Such a
253 | work, in isolation, is not a derivative work of the Library, and
254 | therefore falls outside the scope of this License.
255 |
256 | However, linking a "work that uses the Library" with the Library
257 | creates an executable that is a derivative of the Library (because it
258 | contains portions of the Library), rather than a "work that uses the
259 | library". The executable is therefore covered by this License.
260 | Section 6 states terms for distribution of such executables.
261 |
262 | When a "work that uses the Library" uses material from a header file
263 | that is part of the Library, the object code for the work may be a
264 | derivative work of the Library even though the source code is not.
265 | Whether this is true is especially significant if the work can be
266 | linked without the Library, or if the work is itself a library. The
267 | threshold for this to be true is not precisely defined by law.
268 |
269 | If such an object file uses only numerical parameters, data
270 | structure layouts and accessors, and small macros and small inline
271 | functions (ten lines or less in length), then the use of the object
272 | file is unrestricted, regardless of whether it is legally a derivative
273 | work. (Executables containing this object code plus portions of the
274 | Library will still fall under Section 6.)
275 |
276 | Otherwise, if the work is a derivative of the Library, you may
277 | distribute the object code for the work under the terms of Section 6.
278 | Any executables containing that work also fall under Section 6,
279 | whether or not they are linked directly with the Library itself.
280 |
281 | 6. As an exception to the Sections above, you may also combine or
282 | link a "work that uses the Library" with the Library to produce a
283 | work containing portions of the Library, and distribute that work
284 | under terms of your choice, provided that the terms permit
285 | modification of the work for the customer's own use and reverse
286 | engineering for debugging such modifications.
287 |
288 | You must give prominent notice with each copy of the work that the
289 | Library is used in it and that the Library and its use are covered by
290 | this License. You must supply a copy of this License. If the work
291 | during execution displays copyright notices, you must include the
292 | copyright notice for the Library among them, as well as a reference
293 | directing the user to the copy of this License. Also, you must do one
294 | of these things:
295 |
296 | a) Accompany the work with the complete corresponding
297 | machine-readable source code for the Library including whatever
298 | changes were used in the work (which must be distributed under
299 | Sections 1 and 2 above); and, if the work is an executable linked
300 | with the Library, with the complete machine-readable "work that
301 | uses the Library", as object code and/or source code, so that the
302 | user can modify the Library and then relink to produce a modified
303 | executable containing the modified Library. (It is understood
304 | that the user who changes the contents of definitions files in the
305 | Library will not necessarily be able to recompile the application
306 | to use the modified definitions.)
307 |
308 | b) Use a suitable shared library mechanism for linking with the
309 | Library. A suitable mechanism is one that (1) uses at run time a
310 | copy of the library already present on the user's computer system,
311 | rather than copying library functions into the executable, and (2)
312 | will operate properly with a modified version of the library, if
313 | the user installs one, as long as the modified version is
314 | interface-compatible with the version that the work was made with.
315 |
316 | c) Accompany the work with a written offer, valid for at
317 | least three years, to give the same user the materials
318 | specified in Subsection 6a, above, for a charge no more
319 | than the cost of performing this distribution.
320 |
321 | d) If distribution of the work is made by offering access to copy
322 | from a designated place, offer equivalent access to copy the above
323 | specified materials from the same place.
324 |
325 | e) Verify that the user has already received a copy of these
326 | materials or that you have already sent this user a copy.
327 |
328 | For an executable, the required form of the "work that uses the
329 | Library" must include any data and utility programs needed for
330 | reproducing the executable from it. However, as a special exception,
331 | the materials to be distributed need not include anything that is
332 | normally distributed (in either source or binary form) with the major
333 | components (compiler, kernel, and so on) of the operating system on
334 | which the executable runs, unless that component itself accompanies
335 | the executable.
336 |
337 | It may happen that this requirement contradicts the license
338 | restrictions of other proprietary libraries that do not normally
339 | accompany the operating system. Such a contradiction means you cannot
340 | use both them and the Library together in an executable that you
341 | distribute.
342 |
343 | 7. You may place library facilities that are a work based on the
344 | Library side-by-side in a single library together with other library
345 | facilities not covered by this License, and distribute such a combined
346 | library, provided that the separate distribution of the work based on
347 | the Library and of the other library facilities is otherwise
348 | permitted, and provided that you do these two things:
349 |
350 | a) Accompany the combined library with a copy of the same work
351 | based on the Library, uncombined with any other library
352 | facilities. This must be distributed under the terms of the
353 | Sections above.
354 |
355 | b) Give prominent notice with the combined library of the fact
356 | that part of it is a work based on the Library, and explaining
357 | where to find the accompanying uncombined form of the same work.
358 |
359 | 8. You may not copy, modify, sublicense, link with, or distribute
360 | the Library except as expressly provided under this License. Any
361 | attempt otherwise to copy, modify, sublicense, link with, or
362 | distribute the Library is void, and will automatically terminate your
363 | rights under this License. However, parties who have received copies,
364 | or rights, from you under this License will not have their licenses
365 | terminated so long as such parties remain in full compliance.
366 |
367 | 9. You are not required to accept this License, since you have not
368 | signed it. However, nothing else grants you permission to modify or
369 | distribute the Library or its derivative works. These actions are
370 | prohibited by law if you do not accept this License. Therefore, by
371 | modifying or distributing the Library (or any work based on the
372 | Library), you indicate your acceptance of this License to do so, and
373 | all its terms and conditions for copying, distributing or modifying
374 | the Library or works based on it.
375 |
376 | 10. Each time you redistribute the Library (or any work based on the
377 | Library), the recipient automatically receives a license from the
378 | original licensor to copy, distribute, link with or modify the Library
379 | subject to these terms and conditions. You may not impose any further
380 | restrictions on the recipients' exercise of the rights granted herein.
381 | You are not responsible for enforcing compliance by third parties with
382 | this License.
383 |
384 | 11. If, as a consequence of a court judgment or allegation of patent
385 | infringement or for any other reason (not limited to patent issues),
386 | conditions are imposed on you (whether by court order, agreement or
387 | otherwise) that contradict the conditions of this License, they do not
388 | excuse you from the conditions of this License. If you cannot
389 | distribute so as to satisfy simultaneously your obligations under this
390 | License and any other pertinent obligations, then as a consequence you
391 | may not distribute the Library at all. For example, if a patent
392 | license would not permit royalty-free redistribution of the Library by
393 | all those who receive copies directly or indirectly through you, then
394 | the only way you could satisfy both it and this License would be to
395 | refrain entirely from distribution of the Library.
396 |
397 | If any portion of this section is held invalid or unenforceable under any
398 | particular circumstance, the balance of the section is intended to apply,
399 | and the section as a whole is intended to apply in other circumstances.
400 |
401 | It is not the purpose of this section to induce you to infringe any
402 | patents or other property right claims or to contest validity of any
403 | such claims; this section has the sole purpose of protecting the
404 | integrity of the free software distribution system which is
405 | implemented by public license practices. Many people have made
406 | generous contributions to the wide range of software distributed
407 | through that system in reliance on consistent application of that
408 | system; it is up to the author/donor to decide if he or she is willing
409 | to distribute software through any other system and a licensee cannot
410 | impose that choice.
411 |
412 | This section is intended to make thoroughly clear what is believed to
413 | be a consequence of the rest of this License.
414 |
415 | 12. If the distribution and/or use of the Library is restricted in
416 | certain countries either by patents or by copyrighted interfaces, the
417 | original copyright holder who places the Library under this License may add
418 | an explicit geographical distribution limitation excluding those countries,
419 | so that distribution is permitted only in or among countries not thus
420 | excluded. In such case, this License incorporates the limitation as if
421 | written in the body of this License.
422 |
423 | 13. The Free Software Foundation may publish revised and/or new
424 | versions of the Lesser General Public License from time to time.
425 | Such new versions will be similar in spirit to the present version,
426 | but may differ in detail to address new problems or concerns.
427 |
428 | Each version is given a distinguishing version number. If the Library
429 | specifies a version number of this License which applies to it and
430 | "any later version", you have the option of following the terms and
431 | conditions either of that version or of any later version published by
432 | the Free Software Foundation. If the Library does not specify a
433 | license version number, you may choose any version ever published by
434 | the Free Software Foundation.
435 |
436 | 14. If you wish to incorporate parts of the Library into other free
437 | programs whose distribution conditions are incompatible with these,
438 | write to the author to ask for permission. For software which is
439 | copyrighted by the Free Software Foundation, write to the Free
440 | Software Foundation; we sometimes make exceptions for this. Our
441 | decision will be guided by the two goals of preserving the free status
442 | of all derivatives of our free software and of promoting the sharing
443 | and reuse of software generally.
444 |
445 | NO WARRANTY
446 |
447 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
448 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
449 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
450 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
451 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
452 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
453 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
454 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
455 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
456 |
457 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
458 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
459 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
460 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
461 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
462 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
463 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
464 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
465 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
466 | DAMAGES.
467 |
468 | END OF TERMS AND CONDITIONS
469 |
470 | How to Apply These Terms to Your New Libraries
471 |
472 | If you develop a new library, and you want it to be of the greatest
473 | possible use to the public, we recommend making it free software that
474 | everyone can redistribute and change. You can do so by permitting
475 | redistribution under these terms (or, alternatively, under the terms of the
476 | ordinary General Public License).
477 |
478 | To apply these terms, attach the following notices to the library. It is
479 | safest to attach them to the start of each source file to most effectively
480 | convey the exclusion of warranty; and each file should have at least the
481 | "copyright" line and a pointer to where the full notice is found.
482 |
483 |
484 | Copyright (C)
485 |
486 | This library is free software; you can redistribute it and/or
487 | modify it under the terms of the GNU Lesser General Public
488 | License as published by the Free Software Foundation; either
489 | version 2.1 of the License, or (at your option) any later version.
490 |
491 | This library is distributed in the hope that it will be useful,
492 | but WITHOUT ANY WARRANTY; without even the implied warranty of
493 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
494 | Lesser General Public License for more details.
495 |
496 | You should have received a copy of the GNU Lesser General Public
497 | License along with this library; if not, write to the Free Software
498 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
499 |
500 | Also add information on how to contact you by electronic and paper mail.
501 |
502 | You should also get your employer (if you work as a programmer) or your
503 | school, if any, to sign a "copyright disclaimer" for the library, if
504 | necessary. Here is a sample; alter the names:
505 |
506 | Yoyodyne, Inc., hereby disclaims all copyright interest in the
507 | library `Frob' (a library for tweaking knobs) written by James Random Hacker.
508 |
509 | , 1 April 1990
510 | Ty Coon, President of Vice
511 |
512 | That's all there is to it!
513 |
514 |
515 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/rfc3252.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Network Working Group H. Kennedy
8 | Request for Comments: 3252 Mimezine
9 | Category: Informational 1 April 2002
10 |
11 |
12 | Binary Lexical Octet Ad-hoc Transport
13 |
14 | Status of this Memo
15 |
16 | This memo provides information for the Internet community. It does
17 | not specify an Internet standard of any kind. Distribution of this
18 | memo is unlimited.
19 |
20 | Copyright Notice
21 |
22 | Copyright (C) The Internet Society (2002). All Rights Reserved.
23 |
24 | Abstract
25 |
26 | This document defines a reformulation of IP and two transport layer
27 | protocols (TCP and UDP) as XML applications.
28 |
29 | 1. Introduction
30 |
31 | 1.1. Overview
32 |
33 | This document describes the Binary Lexical Octet Ad-hoc Transport
34 | (BLOAT): a reformulation of a widely-deployed network-layer protocol
35 | (IP [RFC791]), and two associated transport layer protocols (TCP
36 | [RFC793] and UDP [RFC768]) as XML [XML] applications. It also
37 | describes methods for transporting BLOAT over Ethernet and IEEE 802
38 | networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
39 | across the public Internet.
40 |
41 | 1.2. Motivation
42 |
43 | The wild popularity of XML as a basis for application-level protocols
44 | such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
45 | Object Access Protocol [SOAP], and Jabber [JABBER] prompted
46 | investigation into the possibility of extending the use of XML in the
47 | protocol stack. Using XML at both the transport and network layer in
48 | addition to the application layer would provide for an amazing amount
49 | of power and flexibility while removing dependencies on proprietary
50 | and hard-to-understand binary protocols. This protocol unification
51 | would also allow applications to use a single XML parser for all
52 | aspects of their operation, eliminating developer time spent figuring
53 | out the intricacies of each new protocol, and moving the hard work of
54 |
55 |
56 |
57 |
58 | Kennedy Informational [Page 1]
59 |
60 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
61 |
62 |
63 | parsing to the XML toolset. The use of XML also mitigates concerns
64 | over "network vs. host" byte ordering which is at the root of many
65 | network application bugs.
66 |
67 | 1.3. Relation to Existing Protocols
68 |
69 | The reformulations specified in this RFC follow as closely as
70 | possible the spirit of the RFCs on which they are based, and so MAY
71 | contain elements or attributes that would not be needed in a pure
72 | reworking (e.g. length attributes, which are implicit in XML.)
73 |
74 | The layering of network and transport protocols are maintained in
75 | this RFC despite the optimizations that could be made if the line
76 | were somewhat blurred (i.e. merging TCP and IP into a single, larger
77 | element in the DTD) in order to foster future use of this protocol as
78 | a basis for reformulating other protocols (such as ICMP.)
79 |
80 | Other than the encoding, the behavioral aspects of each of the
81 | existing protocols remain unchanged. Routing, address spaces, TCP
82 | congestion control, etc. behave as specified in the extant standards.
83 | Adapting to new standards and experimental algorithm heuristics for
84 | improving performance will become much easier once the move to BLOAT
85 | has been completed.
86 |
87 | 1.4. Requirement Levels
88 |
89 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
90 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
91 | document are to be interpreted as described in BCP 14, RFC 2119
92 | [RFC2119].
93 |
94 | 2. IPoXML
95 |
96 | This protocol MUST be implemented to be compliant with this RFC.
97 | IPoXML is the root protocol REQUIRED for effective use of TCPoXML
98 | (section 3.) and higher-level application protocols.
99 |
100 | The DTD for this document type can be found in section 7.1.
101 |
102 | The routing of IPoXML can be easily implemented on hosts with an XML
103 | parser, as the regular structure lends itself handily to parsing and
104 | validation of the document/datagram and then processing the
105 | destination address, TTL, and checksum before sending it on to its
106 | next-hop.
107 |
108 | The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
109 | wider deployment of IPv4 and the fact that implementing IPv6 as XML
110 | would have exceeded the 1500 byte Ethernet MTU.
111 |
112 |
113 |
114 | Kennedy Informational [Page 2]
115 |
116 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
117 |
118 |
119 | All BLOAT implementations MUST use - and specify - the UTF-8 encoding
120 | of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
121 | formed and include the XMLDecl.
122 |
123 | 2.1. IP Description
124 |
125 | A number of items have changed (for the better) from the original IP
126 | specification. Bit-masks, where present have been converted into
127 | human-readable values. IP addresses are listed in their dotted-
128 | decimal notation [RFC1123]. Length and checksum values are present
129 | as decimal integers.
130 |
131 | To calculate the length and checksum fields of the IP element, a
132 | canonicalized form of the element MUST be used. The canonical form
133 | SHALL have no whitespace (including newline characters) between
134 | elements and only one space character between attributes. There
135 | SHALL NOT be a space following the last attribute in an element.
136 |
137 | An iterative method SHOULD be used to calculate checksums, as the
138 | length field will vary based on the size of the checksum.
139 |
140 | The payload element bears special attention. Due to the character
141 | set restrictions of XML, the payload of IP datagrams (which MAY
142 | contain arbitrary data) MUST be encoded for transport. This RFC
143 | REQUIRES the contents of the payload to be encoded in the base-64
144 | encoding of RFC 2045 [RFC2045], but removes the requirement that the
145 | encoded output MUST be wrapped on 76-character lines.
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | Kennedy Informational [Page 3]
171 |
172 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
173 |
174 |
175 | 2.2. Example Datagram
176 |
177 | The following is an example IPoXML datagram with an empty payload:
178 |
179 |
180 |
181 |
182 |
183 |
184 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | 3. TCPoXML
205 |
206 | This protocol MUST be implemented to be compliant with this RFC. The
207 | DTD for this document type can be found in section 7.2.
208 |
209 | 3.1. TCP Description
210 |
211 | A number of items have changed from the original TCP specification.
212 | Bit-masks, where present have been converted into human-readable
213 | values. Length and checksum and port values are present as decimal
214 | integers.
215 |
216 | To calculate the length and checksum fields of the TCP element, a
217 | canonicalized form of the element MUST be used as in section 2.1.
218 |
219 | An iterative method SHOULD be used to calculate checksums as in
220 | section 2.1.
221 |
222 | The payload element MUST be encoded as in section 2.1.
223 |
224 |
225 |
226 | Kennedy Informational [Page 4]
227 |
228 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
229 |
230 |
231 | The TCP offset element was expanded to a maximum of 255 from 16 to
232 | allow for the increased size of the header in XML.
233 |
234 | TCPoXML datagrams encapsulated by IPoXML MAY omit the header
235 | as well as the declaration.
236 |
237 | 3.2. Example Datagram
238 |
239 | The following is an example TCPoXML datagram with an empty payload:
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 | 4. UDPoXML
265 |
266 | This protocol MUST be implemented to be compliant with this RFC. The
267 | DTD for this document type can be found in section 7.3.
268 |
269 | 4.1. UDP Description
270 |
271 | A number of items have changed from the original UDP specification.
272 | Bit-masks, where present have been converted into human-readable
273 | values. Length and checksum and port values are present as decimal
274 | integers.
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 | Kennedy Informational [Page 5]
283 |
284 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
285 |
286 |
287 | To calculate the length and checksum fields of the UDP element, a
288 | canonicalized form of the element MUST be used as in section 2.1. An
289 | iterative method SHOULD be used to calculate checksums as in section
290 | 2.1.
291 |
292 | The payload element MUST be encoded as in section 2.1.
293 |
294 | UDPoXML datagrams encapsulated by IPoXML MAY omit the header
295 | as well as the declaration.
296 |
297 | 4.2. Example Datagram
298 |
299 | The following is an example UDPoXML datagram with an empty payload:
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 | 5. Network Transport
315 |
316 | This document provides for the transmission of BLOAT datagrams over
317 | two common families of physical layer transport. Future RFCs will
318 | address additional transports as routing vendors catch up to the
319 | specification, and we begin to see BLOAT routed across the Internet
320 | backbone.
321 |
322 | 5.1. Ethernet
323 |
324 | BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
325 | exception that the type field of the Ethernet frame MUST contain the
326 | value 0xBEEF. The first 5 octets of the Ethernet frame payload will
327 | be 0x3c 3f 78 6d 6c ("
367 | -->
368 |
391 |
392 |
393 |
394 | Kennedy Informational [Page 7]
395 |
396 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
413 |
414 |
416 |
417 |
418 |
419 |
421 |
422 |
423 |
429 |
430 |
431 |
436 |
438 |
439 |
440 |
441 |
443 |
444 |
445 |
446 |
458 |
459 |
460 |
461 |
463 |
464 |
465 |
466 |
468 |
469 |
470 |
471 |
473 |
474 |
475 |
476 |
478 |
479 |
480 |
482 |
483 |
484 |
486 |
487 |
489 |
490 |
491 |
495 |
496 |
497 |
501 |
502 |
503 |
504 |
505 |
506 | Kennedy Informational [Page 9]
507 |
508 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
509 |
510 |
511 |
520 |
521 |
527 |
528 |
529 |
531 |
532 |
533 |
539 |
540 |
541 |
547 |
548 |
549 |
550 |
556 |
557 |
558 |
559 |
560 |
561 |
562 | Kennedy Informational [Page 10]
563 |
564 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
565 |
566 |
567 |
575 |
576 |
577 |
580 |
584 |
585 |
587 |
588 |
590 |
591 |
592 | 7.2. TCPoXML DTD
593 |
594 |
600 |
601 |
602 |
603 |
604 |
607 |
608 |
609 |
610 |
612 |
613 |
614 |
615 |
616 |
617 |
618 | Kennedy Informational [Page 11]
619 |
620 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
621 |
622 |
623 |
625 |
626 |
627 |
628 |
630 |
631 |
632 |
633 |
635 |
636 |
637 |
638 |
640 |
641 |
642 |
644 |
645 |
646 |
653 |
654 |
655 |
656 |
658 |
659 |
663 |
665 |
666 |
671 |
672 |
673 |
674 | Kennedy Informational [Page 12]
675 |
676 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
677 |
678 |
679 |
680 |
682 |
683 |
684 |
685 |
687 |
688 |
689 |
690 |
691 |
693 |
694 |
695 |
697 |
698 |
699 |
703 |
704 | 7.3. UDPoXML DTD
705 |
706 |
712 |
713 |
714 |
715 |
716 |
717 |
719 |
720 |
724 |
725 |
727 |
728 |
729 |
730 | Kennedy Informational [Page 13]
731 |
732 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
733 |
734 |
735 | 8. Security Considerations
736 |
737 | XML, as a subset of SGML, has the same security considerations as
738 | specified in SGML Media Types [RFC1874]. Security considerations
739 | that apply to IP, TCP and UDP also likely apply to BLOAT as it does
740 | not attempt to correct for issues not related to message format.
741 |
742 | 9. References
743 |
744 | [JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
745 | February 2002. (Work in Progress)
746 |
747 | [RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
748 | August 1980.
749 |
750 | [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
751 | September 1981.
752 |
753 | [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
754 | 793, September 1981.
755 |
756 | [RFC894] Hornig, C., "Standard for the Transmission of IP
757 | Datagrams over Ethernet Networks.", RFC 894, April 1984.
758 |
759 | [RFC1042] Postel, J. and J. Reynolds, "Standard for the
760 | Transmission of IP Datagrams Over IEEE 802 Networks", STD
761 | 43, RFC 1042, February 1988.
762 |
763 | [RFC1123] Braden, R., "Requirements for Internet Hosts -
764 | Application and Support", RFC 1123, October 1989.
765 |
766 | [RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
767 | 1995.
768 |
769 | [RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
770 | October 1996.
771 |
772 | [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
773 | Extensions (MIME) Part One: Format of Internet Message
774 | Bodies", RFC 2045, November 1996.
775 |
776 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
777 | Requirement Levels", BCP 14, RFC 2119, March 1997.
778 |
779 | [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
780 | 10646", RFC 2279, January 1998.
781 |
782 |
783 |
784 |
785 |
786 | Kennedy Informational [Page 14]
787 |
788 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
789 |
790 |
791 | [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
792 | (IPv6) Specification", RFC 2460, December 1998.
793 |
794 | [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
795 | RFC 3080, March 2001.
796 |
797 | [SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
798 | Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
799 | "Simple Object Access Protocol (SOAP) 1.1" World Wide Web
800 | Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
801 |
802 | [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
803 | Markup Language (XML)" World Wide Web Consortium
804 | Recommendation REC- xml-19980210.
805 | http://www.w3.org/TR/1998/REC-xml-19980210
806 |
807 | 10. Author's Address
808 |
809 | Hugh Kennedy
810 | Mimezine
811 | 1060 West Addison
812 | Chicago, IL 60613
813 | USA
814 |
815 | EMail: kennedyh@engin.umich.edu
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 | Kennedy Informational [Page 15]
843 |
844 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
845 |
846 |
847 | 11. Full Copyright Statement
848 |
849 | Copyright (C) The Internet Society (2002). All Rights Reserved.
850 |
851 | This document and translations of it may be copied and furnished to
852 | others, and derivative works that comment on or otherwise explain it
853 | or assist in its implementation may be prepared, copied, published
854 | and distributed, in whole or in part, without restriction of any
855 | kind, provided that the above copyright notice and this paragraph are
856 | included on all such copies and derivative works. However, this
857 | document itself may not be modified in any way, such as by removing
858 | the copyright notice or references to the Internet Society or other
859 | Internet organizations, except as needed for the purpose of
860 | developing Internet standards in which case the procedures for
861 | copyrights defined in the Internet Standards process must be
862 | followed, or as required to translate it into languages other than
863 | English.
864 |
865 | The limited permissions granted above are perpetual and will not be
866 | revoked by the Internet Society or its successors or assigns.
867 |
868 | This document and the information contained herein is provided on an
869 | "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
870 | TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
871 | BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
872 | HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
873 | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
874 |
875 | Acknowledgement
876 |
877 | Funding for the RFC Editor function is currently provided by the
878 | Internet Society.
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 | Kennedy Informational [Page 16]
899 |
900 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/webserver/rfc3252:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Network Working Group H. Kennedy
8 | Request for Comments: 3252 Mimezine
9 | Category: Informational 1 April 2002
10 |
11 |
12 | Binary Lexical Octet Ad-hoc Transport
13 |
14 | Status of this Memo
15 |
16 | This memo provides information for the Internet community. It does
17 | not specify an Internet standard of any kind. Distribution of this
18 | memo is unlimited.
19 |
20 | Copyright Notice
21 |
22 | Copyright (C) The Internet Society (2002). All Rights Reserved.
23 |
24 | Abstract
25 |
26 | This document defines a reformulation of IP and two transport layer
27 | protocols (TCP and UDP) as XML applications.
28 |
29 | 1. Introduction
30 |
31 | 1.1. Overview
32 |
33 | This document describes the Binary Lexical Octet Ad-hoc Transport
34 | (BLOAT): a reformulation of a widely-deployed network-layer protocol
35 | (IP [RFC791]), and two associated transport layer protocols (TCP
36 | [RFC793] and UDP [RFC768]) as XML [XML] applications. It also
37 | describes methods for transporting BLOAT over Ethernet and IEEE 802
38 | networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
39 | across the public Internet.
40 |
41 | 1.2. Motivation
42 |
43 | The wild popularity of XML as a basis for application-level protocols
44 | such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
45 | Object Access Protocol [SOAP], and Jabber [JABBER] prompted
46 | investigation into the possibility of extending the use of XML in the
47 | protocol stack. Using XML at both the transport and network layer in
48 | addition to the application layer would provide for an amazing amount
49 | of power and flexibility while removing dependencies on proprietary
50 | and hard-to-understand binary protocols. This protocol unification
51 | would also allow applications to use a single XML parser for all
52 | aspects of their operation, eliminating developer time spent figuring
53 | out the intricacies of each new protocol, and moving the hard work of
54 |
55 |
56 |
57 |
58 | Kennedy Informational [Page 1]
59 |
60 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
61 |
62 |
63 | parsing to the XML toolset. The use of XML also mitigates concerns
64 | over "network vs. host" byte ordering which is at the root of many
65 | network application bugs.
66 |
67 | 1.3. Relation to Existing Protocols
68 |
69 | The reformulations specified in this RFC follow as closely as
70 | possible the spirit of the RFCs on which they are based, and so MAY
71 | contain elements or attributes that would not be needed in a pure
72 | reworking (e.g. length attributes, which are implicit in XML.)
73 |
74 | The layering of network and transport protocols are maintained in
75 | this RFC despite the optimizations that could be made if the line
76 | were somewhat blurred (i.e. merging TCP and IP into a single, larger
77 | element in the DTD) in order to foster future use of this protocol as
78 | a basis for reformulating other protocols (such as ICMP.)
79 |
80 | Other than the encoding, the behavioral aspects of each of the
81 | existing protocols remain unchanged. Routing, address spaces, TCP
82 | congestion control, etc. behave as specified in the extant standards.
83 | Adapting to new standards and experimental algorithm heuristics for
84 | improving performance will become much easier once the move to BLOAT
85 | has been completed.
86 |
87 | 1.4. Requirement Levels
88 |
89 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
90 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
91 | document are to be interpreted as described in BCP 14, RFC 2119
92 | [RFC2119].
93 |
94 | 2. IPoXML
95 |
96 | This protocol MUST be implemented to be compliant with this RFC.
97 | IPoXML is the root protocol REQUIRED for effective use of TCPoXML
98 | (section 3.) and higher-level application protocols.
99 |
100 | The DTD for this document type can be found in section 7.1.
101 |
102 | The routing of IPoXML can be easily implemented on hosts with an XML
103 | parser, as the regular structure lends itself handily to parsing and
104 | validation of the document/datagram and then processing the
105 | destination address, TTL, and checksum before sending it on to its
106 | next-hop.
107 |
108 | The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
109 | wider deployment of IPv4 and the fact that implementing IPv6 as XML
110 | would have exceeded the 1500 byte Ethernet MTU.
111 |
112 |
113 |
114 | Kennedy Informational [Page 2]
115 |
116 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
117 |
118 |
119 | All BLOAT implementations MUST use - and specify - the UTF-8 encoding
120 | of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
121 | formed and include the XMLDecl.
122 |
123 | 2.1. IP Description
124 |
125 | A number of items have changed (for the better) from the original IP
126 | specification. Bit-masks, where present have been converted into
127 | human-readable values. IP addresses are listed in their dotted-
128 | decimal notation [RFC1123]. Length and checksum values are present
129 | as decimal integers.
130 |
131 | To calculate the length and checksum fields of the IP element, a
132 | canonicalized form of the element MUST be used. The canonical form
133 | SHALL have no whitespace (including newline characters) between
134 | elements and only one space character between attributes. There
135 | SHALL NOT be a space following the last attribute in an element.
136 |
137 | An iterative method SHOULD be used to calculate checksums, as the
138 | length field will vary based on the size of the checksum.
139 |
140 | The payload element bears special attention. Due to the character
141 | set restrictions of XML, the payload of IP datagrams (which MAY
142 | contain arbitrary data) MUST be encoded for transport. This RFC
143 | REQUIRES the contents of the payload to be encoded in the base-64
144 | encoding of RFC 2045 [RFC2045], but removes the requirement that the
145 | encoded output MUST be wrapped on 76-character lines.
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | Kennedy Informational [Page 3]
171 |
172 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
173 |
174 |
175 | 2.2. Example Datagram
176 |
177 | The following is an example IPoXML datagram with an empty payload:
178 |
179 |
180 |
181 |
182 |
183 |
184 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | 3. TCPoXML
205 |
206 | This protocol MUST be implemented to be compliant with this RFC. The
207 | DTD for this document type can be found in section 7.2.
208 |
209 | 3.1. TCP Description
210 |
211 | A number of items have changed from the original TCP specification.
212 | Bit-masks, where present have been converted into human-readable
213 | values. Length and checksum and port values are present as decimal
214 | integers.
215 |
216 | To calculate the length and checksum fields of the TCP element, a
217 | canonicalized form of the element MUST be used as in section 2.1.
218 |
219 | An iterative method SHOULD be used to calculate checksums as in
220 | section 2.1.
221 |
222 | The payload element MUST be encoded as in section 2.1.
223 |
224 |
225 |
226 | Kennedy Informational [Page 4]
227 |
228 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
229 |
230 |
231 | The TCP offset element was expanded to a maximum of 255 from 16 to
232 | allow for the increased size of the header in XML.
233 |
234 | TCPoXML datagrams encapsulated by IPoXML MAY omit the header
235 | as well as the declaration.
236 |
237 | 3.2. Example Datagram
238 |
239 | The following is an example TCPoXML datagram with an empty payload:
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 | 4. UDPoXML
265 |
266 | This protocol MUST be implemented to be compliant with this RFC. The
267 | DTD for this document type can be found in section 7.3.
268 |
269 | 4.1. UDP Description
270 |
271 | A number of items have changed from the original UDP specification.
272 | Bit-masks, where present have been converted into human-readable
273 | values. Length and checksum and port values are present as decimal
274 | integers.
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 | Kennedy Informational [Page 5]
283 |
284 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
285 |
286 |
287 | To calculate the length and checksum fields of the UDP element, a
288 | canonicalized form of the element MUST be used as in section 2.1. An
289 | iterative method SHOULD be used to calculate checksums as in section
290 | 2.1.
291 |
292 | The payload element MUST be encoded as in section 2.1.
293 |
294 | UDPoXML datagrams encapsulated by IPoXML MAY omit the header
295 | as well as the declaration.
296 |
297 | 4.2. Example Datagram
298 |
299 | The following is an example UDPoXML datagram with an empty payload:
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 | 5. Network Transport
315 |
316 | This document provides for the transmission of BLOAT datagrams over
317 | two common families of physical layer transport. Future RFCs will
318 | address additional transports as routing vendors catch up to the
319 | specification, and we begin to see BLOAT routed across the Internet
320 | backbone.
321 |
322 | 5.1. Ethernet
323 |
324 | BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
325 | exception that the type field of the Ethernet frame MUST contain the
326 | value 0xBEEF. The first 5 octets of the Ethernet frame payload will
327 | be 0x3c 3f 78 6d 6c ("
367 | -->
368 |
391 |
392 |
393 |
394 | Kennedy Informational [Page 7]
395 |
396 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
413 |
414 |
416 |
417 |
418 |
419 |
421 |
422 |
423 |
429 |
430 |
431 |
436 |
438 |
439 |
440 |
441 |
443 |
444 |
445 |
446 |
458 |
459 |
460 |
461 |
463 |
464 |
465 |
466 |
468 |
469 |
470 |
471 |
473 |
474 |
475 |
476 |
478 |
479 |
480 |
482 |
483 |
484 |
486 |
487 |
489 |
490 |
491 |
495 |
496 |
497 |
501 |
502 |
503 |
504 |
505 |
506 | Kennedy Informational [Page 9]
507 |
508 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
509 |
510 |
511 |
520 |
521 |
527 |
528 |
529 |
531 |
532 |
533 |
539 |
540 |
541 |
547 |
548 |
549 |
550 |
556 |
557 |
558 |
559 |
560 |
561 |
562 | Kennedy Informational [Page 10]
563 |
564 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
565 |
566 |
567 |
575 |
576 |
577 |
580 |
584 |
585 |
587 |
588 |
590 |
591 |
592 | 7.2. TCPoXML DTD
593 |
594 |
600 |
601 |
602 |
603 |
604 |
607 |
608 |
609 |
610 |
612 |
613 |
614 |
615 |
616 |
617 |
618 | Kennedy Informational [Page 11]
619 |
620 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
621 |
622 |
623 |
625 |
626 |
627 |
628 |
630 |
631 |
632 |
633 |
635 |
636 |
637 |
638 |
640 |
641 |
642 |
644 |
645 |
646 |
653 |
654 |
655 |
656 |
658 |
659 |
663 |
665 |
666 |
671 |
672 |
673 |
674 | Kennedy Informational [Page 12]
675 |
676 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
677 |
678 |
679 |
680 |
682 |
683 |
684 |
685 |
687 |
688 |
689 |
690 |
691 |
693 |
694 |
695 |
697 |
698 |
699 |
703 |
704 | 7.3. UDPoXML DTD
705 |
706 |
712 |
713 |
714 |
715 |
716 |
717 |
719 |
720 |
724 |
725 |
727 |
728 |
729 |
730 | Kennedy Informational [Page 13]
731 |
732 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
733 |
734 |
735 | 8. Security Considerations
736 |
737 | XML, as a subset of SGML, has the same security considerations as
738 | specified in SGML Media Types [RFC1874]. Security considerations
739 | that apply to IP, TCP and UDP also likely apply to BLOAT as it does
740 | not attempt to correct for issues not related to message format.
741 |
742 | 9. References
743 |
744 | [JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
745 | February 2002. (Work in Progress)
746 |
747 | [RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
748 | August 1980.
749 |
750 | [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
751 | September 1981.
752 |
753 | [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
754 | 793, September 1981.
755 |
756 | [RFC894] Hornig, C., "Standard for the Transmission of IP
757 | Datagrams over Ethernet Networks.", RFC 894, April 1984.
758 |
759 | [RFC1042] Postel, J. and J. Reynolds, "Standard for the
760 | Transmission of IP Datagrams Over IEEE 802 Networks", STD
761 | 43, RFC 1042, February 1988.
762 |
763 | [RFC1123] Braden, R., "Requirements for Internet Hosts -
764 | Application and Support", RFC 1123, October 1989.
765 |
766 | [RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
767 | 1995.
768 |
769 | [RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
770 | October 1996.
771 |
772 | [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
773 | Extensions (MIME) Part One: Format of Internet Message
774 | Bodies", RFC 2045, November 1996.
775 |
776 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
777 | Requirement Levels", BCP 14, RFC 2119, March 1997.
778 |
779 | [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
780 | 10646", RFC 2279, January 1998.
781 |
782 |
783 |
784 |
785 |
786 | Kennedy Informational [Page 14]
787 |
788 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
789 |
790 |
791 | [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
792 | (IPv6) Specification", RFC 2460, December 1998.
793 |
794 | [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
795 | RFC 3080, March 2001.
796 |
797 | [SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
798 | Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
799 | "Simple Object Access Protocol (SOAP) 1.1" World Wide Web
800 | Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
801 |
802 | [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
803 | Markup Language (XML)" World Wide Web Consortium
804 | Recommendation REC- xml-19980210.
805 | http://www.w3.org/TR/1998/REC-xml-19980210
806 |
807 | 10. Author's Address
808 |
809 | Hugh Kennedy
810 | Mimezine
811 | 1060 West Addison
812 | Chicago, IL 60613
813 | USA
814 |
815 | EMail: kennedyh@engin.umich.edu
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 | Kennedy Informational [Page 15]
843 |
844 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
845 |
846 |
847 | 11. Full Copyright Statement
848 |
849 | Copyright (C) The Internet Society (2002). All Rights Reserved.
850 |
851 | This document and translations of it may be copied and furnished to
852 | others, and derivative works that comment on or otherwise explain it
853 | or assist in its implementation may be prepared, copied, published
854 | and distributed, in whole or in part, without restriction of any
855 | kind, provided that the above copyright notice and this paragraph are
856 | included on all such copies and derivative works. However, this
857 | document itself may not be modified in any way, such as by removing
858 | the copyright notice or references to the Internet Society or other
859 | Internet organizations, except as needed for the purpose of
860 | developing Internet standards in which case the procedures for
861 | copyrights defined in the Internet Standards process must be
862 | followed, or as required to translate it into languages other than
863 | English.
864 |
865 | The limited permissions granted above are perpetual and will not be
866 | revoked by the Internet Society or its successors or assigns.
867 |
868 | This document and the information contained herein is provided on an
869 | "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
870 | TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
871 | BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
872 | HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
873 | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
874 |
875 | Acknowledgement
876 |
877 | Funding for the RFC Editor function is currently provided by the
878 | Internet Society.
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 | Kennedy Informational [Page 16]
899 |
900 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/webserver/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Network Working Group H. Kennedy
8 | Request for Comments: 3252 Mimezine
9 | Category: Informational 1 April 2002
10 |
11 |
12 | Binary Lexical Octet Ad-hoc Transport
13 |
14 | Status of this Memo
15 |
16 | This memo provides information for the Internet community. It does
17 | not specify an Internet standard of any kind. Distribution of this
18 | memo is unlimited.
19 |
20 | Copyright Notice
21 |
22 | Copyright (C) The Internet Society (2002). All Rights Reserved.
23 |
24 | Abstract
25 |
26 | This document defines a reformulation of IP and two transport layer
27 | protocols (TCP and UDP) as XML applications.
28 |
29 | 1. Introduction
30 |
31 | 1.1. Overview
32 |
33 | This document describes the Binary Lexical Octet Ad-hoc Transport
34 | (BLOAT): a reformulation of a widely-deployed network-layer protocol
35 | (IP [RFC791]), and two associated transport layer protocols (TCP
36 | [RFC793] and UDP [RFC768]) as XML [XML] applications. It also
37 | describes methods for transporting BLOAT over Ethernet and IEEE 802
38 | networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
39 | across the public Internet.
40 |
41 | 1.2. Motivation
42 |
43 | The wild popularity of XML as a basis for application-level protocols
44 | such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
45 | Object Access Protocol [SOAP], and Jabber [JABBER] prompted
46 | investigation into the possibility of extending the use of XML in the
47 | protocol stack. Using XML at both the transport and network layer in
48 | addition to the application layer would provide for an amazing amount
49 | of power and flexibility while removing dependencies on proprietary
50 | and hard-to-understand binary protocols. This protocol unification
51 | would also allow applications to use a single XML parser for all
52 | aspects of their operation, eliminating developer time spent figuring
53 | out the intricacies of each new protocol, and moving the hard work of
54 |
55 |
56 |
57 |
58 | Kennedy Informational [Page 1]
59 |
60 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
61 |
62 |
63 | parsing to the XML toolset. The use of XML also mitigates concerns
64 | over "network vs. host" byte ordering which is at the root of many
65 | network application bugs.
66 |
67 | 1.3. Relation to Existing Protocols
68 |
69 | The reformulations specified in this RFC follow as closely as
70 | possible the spirit of the RFCs on which they are based, and so MAY
71 | contain elements or attributes that would not be needed in a pure
72 | reworking (e.g. length attributes, which are implicit in XML.)
73 |
74 | The layering of network and transport protocols are maintained in
75 | this RFC despite the optimizations that could be made if the line
76 | were somewhat blurred (i.e. merging TCP and IP into a single, larger
77 | element in the DTD) in order to foster future use of this protocol as
78 | a basis for reformulating other protocols (such as ICMP.)
79 |
80 | Other than the encoding, the behavioral aspects of each of the
81 | existing protocols remain unchanged. Routing, address spaces, TCP
82 | congestion control, etc. behave as specified in the extant standards.
83 | Adapting to new standards and experimental algorithm heuristics for
84 | improving performance will become much easier once the move to BLOAT
85 | has been completed.
86 |
87 | 1.4. Requirement Levels
88 |
89 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
90 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
91 | document are to be interpreted as described in BCP 14, RFC 2119
92 | [RFC2119].
93 |
94 | 2. IPoXML
95 |
96 | This protocol MUST be implemented to be compliant with this RFC.
97 | IPoXML is the root protocol REQUIRED for effective use of TCPoXML
98 | (section 3.) and higher-level application protocols.
99 |
100 | The DTD for this document type can be found in section 7.1.
101 |
102 | The routing of IPoXML can be easily implemented on hosts with an XML
103 | parser, as the regular structure lends itself handily to parsing and
104 | validation of the document/datagram and then processing the
105 | destination address, TTL, and checksum before sending it on to its
106 | next-hop.
107 |
108 | The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
109 | wider deployment of IPv4 and the fact that implementing IPv6 as XML
110 | would have exceeded the 1500 byte Ethernet MTU.
111 |
112 |
113 |
114 | Kennedy Informational [Page 2]
115 |
116 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
117 |
118 |
119 | All BLOAT implementations MUST use - and specify - the UTF-8 encoding
120 | of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
121 | formed and include the XMLDecl.
122 |
123 | 2.1. IP Description
124 |
125 | A number of items have changed (for the better) from the original IP
126 | specification. Bit-masks, where present have been converted into
127 | human-readable values. IP addresses are listed in their dotted-
128 | decimal notation [RFC1123]. Length and checksum values are present
129 | as decimal integers.
130 |
131 | To calculate the length and checksum fields of the IP element, a
132 | canonicalized form of the element MUST be used. The canonical form
133 | SHALL have no whitespace (including newline characters) between
134 | elements and only one space character between attributes. There
135 | SHALL NOT be a space following the last attribute in an element.
136 |
137 | An iterative method SHOULD be used to calculate checksums, as the
138 | length field will vary based on the size of the checksum.
139 |
140 | The payload element bears special attention. Due to the character
141 | set restrictions of XML, the payload of IP datagrams (which MAY
142 | contain arbitrary data) MUST be encoded for transport. This RFC
143 | REQUIRES the contents of the payload to be encoded in the base-64
144 | encoding of RFC 2045 [RFC2045], but removes the requirement that the
145 | encoded output MUST be wrapped on 76-character lines.
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | Kennedy Informational [Page 3]
171 |
172 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
173 |
174 |
175 | 2.2. Example Datagram
176 |
177 | The following is an example IPoXML datagram with an empty payload:
178 |
179 |
180 |
181 |
182 |
183 |
184 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | 3. TCPoXML
205 |
206 | This protocol MUST be implemented to be compliant with this RFC. The
207 | DTD for this document type can be found in section 7.2.
208 |
209 | 3.1. TCP Description
210 |
211 | A number of items have changed from the original TCP specification.
212 | Bit-masks, where present have been converted into human-readable
213 | values. Length and checksum and port values are present as decimal
214 | integers.
215 |
216 | To calculate the length and checksum fields of the TCP element, a
217 | canonicalized form of the element MUST be used as in section 2.1.
218 |
219 | An iterative method SHOULD be used to calculate checksums as in
220 | section 2.1.
221 |
222 | The payload element MUST be encoded as in section 2.1.
223 |
224 |
225 |
226 | Kennedy Informational [Page 4]
227 |
228 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
229 |
230 |
231 | The TCP offset element was expanded to a maximum of 255 from 16 to
232 | allow for the increased size of the header in XML.
233 |
234 | TCPoXML datagrams encapsulated by IPoXML MAY omit the header
235 | as well as the declaration.
236 |
237 | 3.2. Example Datagram
238 |
239 | The following is an example TCPoXML datagram with an empty payload:
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 | 4. UDPoXML
265 |
266 | This protocol MUST be implemented to be compliant with this RFC. The
267 | DTD for this document type can be found in section 7.3.
268 |
269 | 4.1. UDP Description
270 |
271 | A number of items have changed from the original UDP specification.
272 | Bit-masks, where present have been converted into human-readable
273 | values. Length and checksum and port values are present as decimal
274 | integers.
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 | Kennedy Informational [Page 5]
283 |
284 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
285 |
286 |
287 | To calculate the length and checksum fields of the UDP element, a
288 | canonicalized form of the element MUST be used as in section 2.1. An
289 | iterative method SHOULD be used to calculate checksums as in section
290 | 2.1.
291 |
292 | The payload element MUST be encoded as in section 2.1.
293 |
294 | UDPoXML datagrams encapsulated by IPoXML MAY omit the header
295 | as well as the declaration.
296 |
297 | 4.2. Example Datagram
298 |
299 | The following is an example UDPoXML datagram with an empty payload:
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 | 5. Network Transport
315 |
316 | This document provides for the transmission of BLOAT datagrams over
317 | two common families of physical layer transport. Future RFCs will
318 | address additional transports as routing vendors catch up to the
319 | specification, and we begin to see BLOAT routed across the Internet
320 | backbone.
321 |
322 | 5.1. Ethernet
323 |
324 | BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
325 | exception that the type field of the Ethernet frame MUST contain the
326 | value 0xBEEF. The first 5 octets of the Ethernet frame payload will
327 | be 0x3c 3f 78 6d 6c ("
367 | -->
368 |
391 |
392 |
393 |
394 | Kennedy Informational [Page 7]
395 |
396 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
413 |
414 |
416 |
417 |
418 |
419 |
421 |
422 |
423 |
429 |
430 |
431 |
436 |
438 |
439 |
440 |
441 |
443 |
444 |
445 |
446 |
458 |
459 |
460 |
461 |
463 |
464 |
465 |
466 |
468 |
469 |
470 |
471 |
473 |
474 |
475 |
476 |
478 |
479 |
480 |
482 |
483 |
484 |
486 |
487 |
489 |
490 |
491 |
495 |
496 |
497 |
501 |
502 |
503 |
504 |
505 |
506 | Kennedy Informational [Page 9]
507 |
508 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
509 |
510 |
511 |
520 |
521 |
527 |
528 |
529 |
531 |
532 |
533 |
539 |
540 |
541 |
547 |
548 |
549 |
550 |
556 |
557 |
558 |
559 |
560 |
561 |
562 | Kennedy Informational [Page 10]
563 |
564 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
565 |
566 |
567 |
575 |
576 |
577 |
580 |
584 |
585 |
587 |
588 |
590 |
591 |
592 | 7.2. TCPoXML DTD
593 |
594 |
600 |
601 |
602 |
603 |
604 |
607 |
608 |
609 |
610 |
612 |
613 |
614 |
615 |
616 |
617 |
618 | Kennedy Informational [Page 11]
619 |
620 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
621 |
622 |
623 |
625 |
626 |
627 |
628 |
630 |
631 |
632 |
633 |
635 |
636 |
637 |
638 |
640 |
641 |
642 |
644 |
645 |
646 |
653 |
654 |
655 |
656 |
658 |
659 |
663 |
665 |
666 |
671 |
672 |
673 |
674 | Kennedy Informational [Page 12]
675 |
676 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
677 |
678 |
679 |
680 |
682 |
683 |
684 |
685 |
687 |
688 |
689 |
690 |
691 |
693 |
694 |
695 |
697 |
698 |
699 |
703 |
704 | 7.3. UDPoXML DTD
705 |
706 |
712 |
713 |
714 |
715 |
716 |
717 |
719 |
720 |
724 |
725 |
727 |
728 |
729 |
730 | Kennedy Informational [Page 13]
731 |
732 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
733 |
734 |
735 | 8. Security Considerations
736 |
737 | XML, as a subset of SGML, has the same security considerations as
738 | specified in SGML Media Types [RFC1874]. Security considerations
739 | that apply to IP, TCP and UDP also likely apply to BLOAT as it does
740 | not attempt to correct for issues not related to message format.
741 |
742 | 9. References
743 |
744 | [JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
745 | February 2002. (Work in Progress)
746 |
747 | [RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
748 | August 1980.
749 |
750 | [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
751 | September 1981.
752 |
753 | [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
754 | 793, September 1981.
755 |
756 | [RFC894] Hornig, C., "Standard for the Transmission of IP
757 | Datagrams over Ethernet Networks.", RFC 894, April 1984.
758 |
759 | [RFC1042] Postel, J. and J. Reynolds, "Standard for the
760 | Transmission of IP Datagrams Over IEEE 802 Networks", STD
761 | 43, RFC 1042, February 1988.
762 |
763 | [RFC1123] Braden, R., "Requirements for Internet Hosts -
764 | Application and Support", RFC 1123, October 1989.
765 |
766 | [RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
767 | 1995.
768 |
769 | [RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
770 | October 1996.
771 |
772 | [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
773 | Extensions (MIME) Part One: Format of Internet Message
774 | Bodies", RFC 2045, November 1996.
775 |
776 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
777 | Requirement Levels", BCP 14, RFC 2119, March 1997.
778 |
779 | [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
780 | 10646", RFC 2279, January 1998.
781 |
782 |
783 |
784 |
785 |
786 | Kennedy Informational [Page 14]
787 |
788 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
789 |
790 |
791 | [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
792 | (IPv6) Specification", RFC 2460, December 1998.
793 |
794 | [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
795 | RFC 3080, March 2001.
796 |
797 | [SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
798 | Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
799 | "Simple Object Access Protocol (SOAP) 1.1" World Wide Web
800 | Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
801 |
802 | [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
803 | Markup Language (XML)" World Wide Web Consortium
804 | Recommendation REC- xml-19980210.
805 | http://www.w3.org/TR/1998/REC-xml-19980210
806 |
807 | 10. Author's Address
808 |
809 | Hugh Kennedy
810 | Mimezine
811 | 1060 West Addison
812 | Chicago, IL 60613
813 | USA
814 |
815 | EMail: kennedyh@engin.umich.edu
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 | Kennedy Informational [Page 15]
843 |
844 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
845 |
846 |
847 | 11. Full Copyright Statement
848 |
849 | Copyright (C) The Internet Society (2002). All Rights Reserved.
850 |
851 | This document and translations of it may be copied and furnished to
852 | others, and derivative works that comment on or otherwise explain it
853 | or assist in its implementation may be prepared, copied, published
854 | and distributed, in whole or in part, without restriction of any
855 | kind, provided that the above copyright notice and this paragraph are
856 | included on all such copies and derivative works. However, this
857 | document itself may not be modified in any way, such as by removing
858 | the copyright notice or references to the Internet Society or other
859 | Internet organizations, except as needed for the purpose of
860 | developing Internet standards in which case the procedures for
861 | copyrights defined in the Internet Standards process must be
862 | followed, or as required to translate it into languages other than
863 | English.
864 |
865 | The limited permissions granted above are perpetual and will not be
866 | revoked by the Internet Society or its successors or assigns.
867 |
868 | This document and the information contained herein is provided on an
869 | "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
870 | TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
871 | BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
872 | HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
873 | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
874 |
875 | Acknowledgement
876 |
877 | Funding for the RFC Editor function is currently provided by the
878 | Internet Society.
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 | Kennedy Informational [Page 16]
899 |
900 |
--------------------------------------------------------------------------------
/tests/auto/qhttp/webserver/rfc3252.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Network Working Group H. Kennedy
8 | Request for Comments: 3252 Mimezine
9 | Category: Informational 1 April 2002
10 |
11 |
12 | Binary Lexical Octet Ad-hoc Transport
13 |
14 | Status of this Memo
15 |
16 | This memo provides information for the Internet community. It does
17 | not specify an Internet standard of any kind. Distribution of this
18 | memo is unlimited.
19 |
20 | Copyright Notice
21 |
22 | Copyright (C) The Internet Society (2002). All Rights Reserved.
23 |
24 | Abstract
25 |
26 | This document defines a reformulation of IP and two transport layer
27 | protocols (TCP and UDP) as XML applications.
28 |
29 | 1. Introduction
30 |
31 | 1.1. Overview
32 |
33 | This document describes the Binary Lexical Octet Ad-hoc Transport
34 | (BLOAT): a reformulation of a widely-deployed network-layer protocol
35 | (IP [RFC791]), and two associated transport layer protocols (TCP
36 | [RFC793] and UDP [RFC768]) as XML [XML] applications. It also
37 | describes methods for transporting BLOAT over Ethernet and IEEE 802
38 | networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
39 | across the public Internet.
40 |
41 | 1.2. Motivation
42 |
43 | The wild popularity of XML as a basis for application-level protocols
44 | such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
45 | Object Access Protocol [SOAP], and Jabber [JABBER] prompted
46 | investigation into the possibility of extending the use of XML in the
47 | protocol stack. Using XML at both the transport and network layer in
48 | addition to the application layer would provide for an amazing amount
49 | of power and flexibility while removing dependencies on proprietary
50 | and hard-to-understand binary protocols. This protocol unification
51 | would also allow applications to use a single XML parser for all
52 | aspects of their operation, eliminating developer time spent figuring
53 | out the intricacies of each new protocol, and moving the hard work of
54 |
55 |
56 |
57 |
58 | Kennedy Informational [Page 1]
59 |
60 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
61 |
62 |
63 | parsing to the XML toolset. The use of XML also mitigates concerns
64 | over "network vs. host" byte ordering which is at the root of many
65 | network application bugs.
66 |
67 | 1.3. Relation to Existing Protocols
68 |
69 | The reformulations specified in this RFC follow as closely as
70 | possible the spirit of the RFCs on which they are based, and so MAY
71 | contain elements or attributes that would not be needed in a pure
72 | reworking (e.g. length attributes, which are implicit in XML.)
73 |
74 | The layering of network and transport protocols are maintained in
75 | this RFC despite the optimizations that could be made if the line
76 | were somewhat blurred (i.e. merging TCP and IP into a single, larger
77 | element in the DTD) in order to foster future use of this protocol as
78 | a basis for reformulating other protocols (such as ICMP.)
79 |
80 | Other than the encoding, the behavioral aspects of each of the
81 | existing protocols remain unchanged. Routing, address spaces, TCP
82 | congestion control, etc. behave as specified in the extant standards.
83 | Adapting to new standards and experimental algorithm heuristics for
84 | improving performance will become much easier once the move to BLOAT
85 | has been completed.
86 |
87 | 1.4. Requirement Levels
88 |
89 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
90 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
91 | document are to be interpreted as described in BCP 14, RFC 2119
92 | [RFC2119].
93 |
94 | 2. IPoXML
95 |
96 | This protocol MUST be implemented to be compliant with this RFC.
97 | IPoXML is the root protocol REQUIRED for effective use of TCPoXML
98 | (section 3.) and higher-level application protocols.
99 |
100 | The DTD for this document type can be found in section 7.1.
101 |
102 | The routing of IPoXML can be easily implemented on hosts with an XML
103 | parser, as the regular structure lends itself handily to parsing and
104 | validation of the document/datagram and then processing the
105 | destination address, TTL, and checksum before sending it on to its
106 | next-hop.
107 |
108 | The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
109 | wider deployment of IPv4 and the fact that implementing IPv6 as XML
110 | would have exceeded the 1500 byte Ethernet MTU.
111 |
112 |
113 |
114 | Kennedy Informational [Page 2]
115 |
116 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
117 |
118 |
119 | All BLOAT implementations MUST use - and specify - the UTF-8 encoding
120 | of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
121 | formed and include the XMLDecl.
122 |
123 | 2.1. IP Description
124 |
125 | A number of items have changed (for the better) from the original IP
126 | specification. Bit-masks, where present have been converted into
127 | human-readable values. IP addresses are listed in their dotted-
128 | decimal notation [RFC1123]. Length and checksum values are present
129 | as decimal integers.
130 |
131 | To calculate the length and checksum fields of the IP element, a
132 | canonicalized form of the element MUST be used. The canonical form
133 | SHALL have no whitespace (including newline characters) between
134 | elements and only one space character between attributes. There
135 | SHALL NOT be a space following the last attribute in an element.
136 |
137 | An iterative method SHOULD be used to calculate checksums, as the
138 | length field will vary based on the size of the checksum.
139 |
140 | The payload element bears special attention. Due to the character
141 | set restrictions of XML, the payload of IP datagrams (which MAY
142 | contain arbitrary data) MUST be encoded for transport. This RFC
143 | REQUIRES the contents of the payload to be encoded in the base-64
144 | encoding of RFC 2045 [RFC2045], but removes the requirement that the
145 | encoded output MUST be wrapped on 76-character lines.
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | Kennedy Informational [Page 3]
171 |
172 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
173 |
174 |
175 | 2.2. Example Datagram
176 |
177 | The following is an example IPoXML datagram with an empty payload:
178 |
179 |
180 |
181 |
182 |
183 |
184 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | 3. TCPoXML
205 |
206 | This protocol MUST be implemented to be compliant with this RFC. The
207 | DTD for this document type can be found in section 7.2.
208 |
209 | 3.1. TCP Description
210 |
211 | A number of items have changed from the original TCP specification.
212 | Bit-masks, where present have been converted into human-readable
213 | values. Length and checksum and port values are present as decimal
214 | integers.
215 |
216 | To calculate the length and checksum fields of the TCP element, a
217 | canonicalized form of the element MUST be used as in section 2.1.
218 |
219 | An iterative method SHOULD be used to calculate checksums as in
220 | section 2.1.
221 |
222 | The payload element MUST be encoded as in section 2.1.
223 |
224 |
225 |
226 | Kennedy Informational [Page 4]
227 |
228 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
229 |
230 |
231 | The TCP offset element was expanded to a maximum of 255 from 16 to
232 | allow for the increased size of the header in XML.
233 |
234 | TCPoXML datagrams encapsulated by IPoXML MAY omit the header
235 | as well as the declaration.
236 |
237 | 3.2. Example Datagram
238 |
239 | The following is an example TCPoXML datagram with an empty payload:
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 | 4. UDPoXML
265 |
266 | This protocol MUST be implemented to be compliant with this RFC. The
267 | DTD for this document type can be found in section 7.3.
268 |
269 | 4.1. UDP Description
270 |
271 | A number of items have changed from the original UDP specification.
272 | Bit-masks, where present have been converted into human-readable
273 | values. Length and checksum and port values are present as decimal
274 | integers.
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 | Kennedy Informational [Page 5]
283 |
284 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
285 |
286 |
287 | To calculate the length and checksum fields of the UDP element, a
288 | canonicalized form of the element MUST be used as in section 2.1. An
289 | iterative method SHOULD be used to calculate checksums as in section
290 | 2.1.
291 |
292 | The payload element MUST be encoded as in section 2.1.
293 |
294 | UDPoXML datagrams encapsulated by IPoXML MAY omit the header
295 | as well as the declaration.
296 |
297 | 4.2. Example Datagram
298 |
299 | The following is an example UDPoXML datagram with an empty payload:
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 | 5. Network Transport
315 |
316 | This document provides for the transmission of BLOAT datagrams over
317 | two common families of physical layer transport. Future RFCs will
318 | address additional transports as routing vendors catch up to the
319 | specification, and we begin to see BLOAT routed across the Internet
320 | backbone.
321 |
322 | 5.1. Ethernet
323 |
324 | BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
325 | exception that the type field of the Ethernet frame MUST contain the
326 | value 0xBEEF. The first 5 octets of the Ethernet frame payload will
327 | be 0x3c 3f 78 6d 6c ("
367 | -->
368 |
391 |
392 |
393 |
394 | Kennedy Informational [Page 7]
395 |
396 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
413 |
414 |
416 |
417 |
418 |
419 |
421 |
422 |
423 |
429 |
430 |
431 |
436 |
438 |
439 |
440 |
441 |
443 |
444 |
445 |
446 |
458 |
459 |
460 |
461 |
463 |
464 |
465 |
466 |
468 |
469 |
470 |
471 |
473 |
474 |
475 |
476 |
478 |
479 |
480 |
482 |
483 |
484 |
486 |
487 |
489 |
490 |
491 |
495 |
496 |
497 |
501 |
502 |
503 |
504 |
505 |
506 | Kennedy Informational [Page 9]
507 |
508 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
509 |
510 |
511 |
520 |
521 |
527 |
528 |
529 |
531 |
532 |
533 |
539 |
540 |
541 |
547 |
548 |
549 |
550 |
556 |
557 |
558 |
559 |
560 |
561 |
562 | Kennedy Informational [Page 10]
563 |
564 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
565 |
566 |
567 |
575 |
576 |
577 |
580 |
584 |
585 |
587 |
588 |
590 |
591 |
592 | 7.2. TCPoXML DTD
593 |
594 |
600 |
601 |
602 |
603 |
604 |
607 |
608 |
609 |
610 |
612 |
613 |
614 |
615 |
616 |
617 |
618 | Kennedy Informational [Page 11]
619 |
620 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
621 |
622 |
623 |
625 |
626 |
627 |
628 |
630 |
631 |
632 |
633 |
635 |
636 |
637 |
638 |
640 |
641 |
642 |
644 |
645 |
646 |
653 |
654 |
655 |
656 |
658 |
659 |
663 |
665 |
666 |
671 |
672 |
673 |
674 | Kennedy Informational [Page 12]
675 |
676 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
677 |
678 |
679 |
680 |
682 |
683 |
684 |
685 |
687 |
688 |
689 |
690 |
691 |
693 |
694 |
695 |
697 |
698 |
699 |
703 |
704 | 7.3. UDPoXML DTD
705 |
706 |
712 |
713 |
714 |
715 |
716 |
717 |
719 |
720 |
724 |
725 |
727 |
728 |
729 |
730 | Kennedy Informational [Page 13]
731 |
732 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
733 |
734 |
735 | 8. Security Considerations
736 |
737 | XML, as a subset of SGML, has the same security considerations as
738 | specified in SGML Media Types [RFC1874]. Security considerations
739 | that apply to IP, TCP and UDP also likely apply to BLOAT as it does
740 | not attempt to correct for issues not related to message format.
741 |
742 | 9. References
743 |
744 | [JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
745 | February 2002. (Work in Progress)
746 |
747 | [RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
748 | August 1980.
749 |
750 | [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
751 | September 1981.
752 |
753 | [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
754 | 793, September 1981.
755 |
756 | [RFC894] Hornig, C., "Standard for the Transmission of IP
757 | Datagrams over Ethernet Networks.", RFC 894, April 1984.
758 |
759 | [RFC1042] Postel, J. and J. Reynolds, "Standard for the
760 | Transmission of IP Datagrams Over IEEE 802 Networks", STD
761 | 43, RFC 1042, February 1988.
762 |
763 | [RFC1123] Braden, R., "Requirements for Internet Hosts -
764 | Application and Support", RFC 1123, October 1989.
765 |
766 | [RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
767 | 1995.
768 |
769 | [RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
770 | October 1996.
771 |
772 | [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
773 | Extensions (MIME) Part One: Format of Internet Message
774 | Bodies", RFC 2045, November 1996.
775 |
776 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
777 | Requirement Levels", BCP 14, RFC 2119, March 1997.
778 |
779 | [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
780 | 10646", RFC 2279, January 1998.
781 |
782 |
783 |
784 |
785 |
786 | Kennedy Informational [Page 14]
787 |
788 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
789 |
790 |
791 | [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
792 | (IPv6) Specification", RFC 2460, December 1998.
793 |
794 | [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
795 | RFC 3080, March 2001.
796 |
797 | [SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
798 | Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
799 | "Simple Object Access Protocol (SOAP) 1.1" World Wide Web
800 | Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
801 |
802 | [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
803 | Markup Language (XML)" World Wide Web Consortium
804 | Recommendation REC- xml-19980210.
805 | http://www.w3.org/TR/1998/REC-xml-19980210
806 |
807 | 10. Author's Address
808 |
809 | Hugh Kennedy
810 | Mimezine
811 | 1060 West Addison
812 | Chicago, IL 60613
813 | USA
814 |
815 | EMail: kennedyh@engin.umich.edu
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 | Kennedy Informational [Page 15]
843 |
844 | RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
845 |
846 |
847 | 11. Full Copyright Statement
848 |
849 | Copyright (C) The Internet Society (2002). All Rights Reserved.
850 |
851 | This document and translations of it may be copied and furnished to
852 | others, and derivative works that comment on or otherwise explain it
853 | or assist in its implementation may be prepared, copied, published
854 | and distributed, in whole or in part, without restriction of any
855 | kind, provided that the above copyright notice and this paragraph are
856 | included on all such copies and derivative works. However, this
857 | document itself may not be modified in any way, such as by removing
858 | the copyright notice or references to the Internet Society or other
859 | Internet organizations, except as needed for the purpose of
860 | developing Internet standards in which case the procedures for
861 | copyrights defined in the Internet Standards process must be
862 | followed, or as required to translate it into languages other than
863 | English.
864 |
865 | The limited permissions granted above are perpetual and will not be
866 | revoked by the Internet Society or its successors or assigns.
867 |
868 | This document and the information contained herein is provided on an
869 | "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
870 | TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
871 | BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
872 | HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
873 | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
874 |
875 | Acknowledgement
876 |
877 | Funding for the RFC Editor function is currently provided by the
878 | Internet Society.
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 | Kennedy Informational [Page 16]
899 |
900 |
--------------------------------------------------------------------------------