[PATCH] Disabling WEBDAV when QT_NO_DOM is defined
Luciano Montanaro
mikelima at virgilio.it
Wed May 7 15:01:43 BST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I am working on konqueror-embedded, and I am trying to squeeze the most out of
Konqueror to make it fit in our set-top-box.
To do that, I compile Qt with the QT_NO_DOM flag, so the DOM Classes are left
out of Our compilation of the Qt library.
Since our embedded browser does not need WebDAV, I simply changed the http
IOSlave to remove webdav support conditionally.
The patch does not change the behaviour of the normal compilation.
Since we are in argument, couldn't WebDAV be a subclass of the http ioslave?
The http ioslave is quite difficult to dig through, even without webdav
support.
The patch is against KDE_3_1_BRANCH.
Luciano
Index: http.cc
===================================================================
RCS file: /home/cvs/cvsroot/kdelibs/kioslave/http/http.cc,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 http.cc
- --- http.cc 17 Apr 2003 09:22:34 -0000 1.1.1.2
+++ http.cc 7 May 2003 12:48:30 -0000
@@ -337,9 +337,11 @@
{
kdDebug(7113) << "(" << m_pid << ") Hostname is now: " << host << endl;
+#if !defined(QT_NO_DOM)
// Reset the webdav-capable flags for this host
if ( m_request.hostname != host )
m_davHostOk = m_davHostUnsupported = false;
+#endif
m_request.hostname = host;
m_request.port = (port == 0) ? m_iDefaultPort : port;
@@ -510,9 +512,12 @@
return;
}
+#if !defined(QT_NO_DOM)
davStatList( url );
+#endif
}
+#if !defined(QT_NO_DOM)
void HTTPProtocol::listDir( const KURL& url )
{
kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::listDir " << url.url()
@@ -681,6 +686,7 @@
retrieveContent( false );
}
+#endif
int HTTPProtocol::codeFromResponse( const QString& response )
{
@@ -689,6 +695,7 @@
return response.mid( firstSpace + 1, secondSpace - firstSpace - 1
).toInt();
}
+#if !defined(QT_NO_DOM)
void HTTPProtocol::davParsePropstats( const QDomNodeList& propstats,
UDSEntry& entry )
{
UDSAtom atom;
@@ -923,6 +930,7 @@
}
}
}
+#endif
long HTTPProtocol::parseDateTime( const QString& input, const QString& type )
{
@@ -943,6 +951,7 @@
return KRFCDate::parseDateISO8601( input );
}
+#if !defined(QT_NO_DOM)
QString HTTPProtocol::davProcessLocks()
{
if ( hasMetaData( "davLockCount" ) )
@@ -1077,6 +1086,7 @@
else
davError();
}
+#endif
void HTTPProtocol::get( const KURL& url )
{
@@ -1120,6 +1130,7 @@
retrieveHeader( true );
}
+#if !defined(QT_NO_DOM)
void HTTPProtocol::copy( const KURL& src, const KURL& dest, int, bool
overwrite )
{
kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::copy " << src.prettyURL()
@@ -1200,6 +1211,7 @@
else
davError();
}
+#endif
void HTTPProtocol::post( const KURL& url )
{
@@ -1218,6 +1230,7 @@
retrieveContent();
}
+#if !defined(QT_NO_DOM)
void HTTPProtocol::davLock( const KURL& url, const QString& scope,
const QString& type, const QString& owner )
{
@@ -1506,6 +1519,7 @@
return errorString;
}
+#endif
void HTTPProtocol::multiGet(const QByteArray &data)
{
@@ -1975,6 +1989,7 @@
header = "OPTIONS ";
m_request.bCachedWrite = false; // Do not put any result in the cache
break;
+#if !defined(QT_NO_DOM)
case DAV_PROPFIND:
header = "PROPFIND ";
davData = true;
@@ -2040,6 +2055,7 @@
davData = true;
m_request.bCachedWrite = false;
break;
+#endif
default:
error (ERR_UNSUPPORTED_ACTION, QString::null);
return false;
@@ -2249,7 +2265,7 @@
// Do we need to authorize to the proxy server ?
if ( m_state.doProxy && !m_bIsTunneled )
header += proxyAuthenticationHeader();
- -
+#if !defined(QT_NO_DOM)
if ( m_protocol == "webdav" || m_protocol == "webdavs" )
{
header += davProcessLocks();
@@ -2267,6 +2283,7 @@
if ( !davHeader.isNull() )
header += davHeader;
}
+#endif
}
kdDebug(7103) << "(" << m_pid << ") ============ Sending Header:" << endl;
@@ -3018,6 +3035,7 @@
m_sContentMD5 = QString::fromLatin1(trimLead(buf + 12));
}
+#if !defined(QT_NO_DOM)
// *** Responses to the HTTP OPTIONS method follow
// WebDAV capabilities
else if (strncasecmp(buf, "DAV:", 4) == 0) {
@@ -3029,6 +3047,7 @@
m_davVersions += QString::fromLatin1(trimLead(buf + 4));
}
}
+#endif
// *** Responses to the HTTP OPTIONS method finished
}
else if (buf[0] == '<')
@@ -3634,6 +3653,7 @@
cacheUpdate( url, no_cache, expireDate );
break;
}
+#if !defined(QT_NO_DOM)
case 5: // WebDAV lock
{
KURL url;
@@ -3657,6 +3677,7 @@
davGeneric( url, (KIO::HTTP_METHOD) method );
break;
}
+#endif
case 99: // Close Connection
{
httpCloseConnection();
@@ -3794,10 +3815,12 @@
}
else
{
+#if !defined(QT_NO_DOM)
uint old_size = m_bufWebDavData.size();
m_bufWebDavData.resize (old_size + m_bufReceive.size());
memcpy (m_bufWebDavData.data() + old_size, m_bufReceive.data(),
m_bufReceive.size());
+#endif
}
}
@@ -3824,8 +3847,10 @@
// This is used for returning data to WebDAV.
m_dataInternal = dataInternal;
+#if !defined(QT_NO_DOM)
if ( dataInternal )
m_bufWebDavData.resize (0);
+#endif
// Check if we need to decode the data.
// If we are in copy mode, then use only transfer decoding.
Index: http.h
===================================================================
RCS file: /home/cvs/cvsroot/kdelibs/kioslave/http/http.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 http.h
- --- http.h 9 Apr 2003 08:55:13 -0000 1.1.1.1
+++ http.h 7 May 2003 12:48:30 -0000
@@ -82,6 +82,7 @@
bool doProxy;
};
+#if !defined(QT_NO_DOM)
/** DAV-specific request elements for the current connection **/
struct DAVRequest
{
@@ -95,6 +96,7 @@
bool overwrite;
int depth;
};
+#endif
/** The request for the current connection **/
struct HTTPRequest
@@ -139,7 +141,9 @@
bool disablePassDlg;
QString userAgent;
QString id;
+#if !defined(QT_NO_DOM)
DAVRequest davData;
+#endif
bool bNoAuth; // Do not authenticate
@@ -191,6 +195,7 @@
virtual void put( const KURL& url, int _mode, bool _overwrite,
bool _resume );
+#if !defined(QT_NO_DOM)
//----------------- Re-implemented methods for WebDAV -----------
virtual void listDir( const KURL& url );
virtual void mkdir( const KURL& url, int _permissions );
@@ -215,6 +220,7 @@
// Handle error conditions
QString davError( int code = -1, QString url = QString::null );
+#endif
//---------------------------- End WebDAV -----------------------
/**
@@ -295,6 +301,7 @@
// to an internal function.
bool readBody( bool dataInternal = false );
+#if !defined(QT_NO_DOM)
/**
* Performs a WebDAV stat or list
*/
@@ -304,6 +311,7 @@
void davParseActiveLocks( const QDomNodeList& activeLocks,
uint& lockCount );
+#endif
/**
* Parses a date & time string
*/
@@ -314,12 +322,14 @@
*/
int codeFromResponse( const QString& response );
+#if !defined(QT_NO_DOM)
/**
* Extracts locks from metadata
* Returns the appropriate If: header
*/
QString davProcessLocks();
- -
+#endif
+
/**
* Send a cookie to the cookiejar
*/
@@ -475,7 +485,7 @@
QString m_sContentMD5;
QString m_strMimeType;
- -
+#if !defined(QT_NO_DOM)
//--- WebDAV
// Data structure to hold data which will be passed to an internal func.
QByteArray m_bufWebDavData;
@@ -484,6 +494,7 @@
bool m_davHostOk;
bool m_davHostUnsupported;
//----------
+#endif
// Holds the POST data so it won't get lost on if we
// happend to get a 401/407 response when submitting,
- --
Luciano Montanaro// My public GPG key can be /"\ ASCII RIBBON
\X/ found at wwwkeys.pgp.net \ / CAMPAIGN
X AGAINST HTML
/ \ MAIL
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE+uRHOaeOY6B53J4URAjL0AJ9rnnwmvZIBm9ULh90OztgUoWjVQgCffFgr
NCwzfqVVHcGBsMJCs1rh5zs=
=PsMd
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list