• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIOSlave

HTTPProtocol Class Reference

#include <http.h>

Inheritance diagram for HTTPProtocol:

Inheritance graph
[legend]

List of all members.


Classes

struct  CacheTag
struct  DAVRequest
 DAV-specific request elements for the current connection. More...
struct  HTTPRequest
 The request for the current connection. More...
struct  HTTPServerState
 State of the current connection to the server. More...

Public Types

enum  AUTH_SCHEME {
  AUTH_None, AUTH_Basic, AUTH_NTLM, AUTH_Digest,
  AUTH_Negotiate
}
enum  HTTP_REV {
  HTTP_None, HTTP_Unknown, HTTP_10, HTTP_11,
  SHOUTCAST
}

Public Member Functions

void cacheUpdate (const KUrl &url, bool nocache, time_t expireDate)
virtual void closeConnection ()
virtual void copy (const KUrl &src, const KUrl &dest, int _permissions, KIO::JobFlags flags)
QString davError (int code=-1, const QString &url=QString())
void davFinished ()
void davGeneric (const KUrl &url, KIO::HTTP_METHOD method)
bool davHostOk ()
void davLock (const KUrl &url, const QString &scope, const QString &type, const QString &owner)
void davUnlock (const KUrl &url)
virtual void del (const KUrl &url, bool _isfile)
virtual void get (const KUrl &url)
void httpError ()
 HTTPProtocol (const QByteArray &protocol, const QByteArray &pool, const QByteArray &app)
bool isOffline (const KUrl &url)
virtual void listDir (const KUrl &url)
bool maybeSetRequestUrl (const KUrl &)
virtual void mimetype (const KUrl &url)
virtual void mkdir (const KUrl &url, int _permissions)
void multiGet (const QByteArray &data)
void post (const KUrl &url)
virtual void put (const KUrl &url, int _mode, KIO::JobFlags flags)
virtual void rename (const KUrl &src, const KUrl &dest, KIO::JobFlags flags)
virtual void reparseConfiguration ()
virtual void setHost (const QString &host, quint16 port, const QString &user, const QString &pass)
virtual void slave_status ()
virtual void special (const QByteArray &data)
virtual void stat (const KUrl &url)
virtual ~HTTPProtocol ()

Protected Slots

void error (int errid, const QString &text)
void proxyAuthenticationForSocket (const QNetworkProxy &, QAuthenticator *)
void saveProxyAuthenticationForSocket ()
void slotData (const QByteArray &)

Protected Member Functions

void addCookies (const QString &url, const QByteArray &cookieHeader)
void addEncoding (const QString &, QStringList &)
QString authenticationHeader ()
gzFile checkCacheEntry (bool readWrite=false)
void cleanCache ()
void clearUnreadBuffer ()
void closeCacheEntry ()
int codeFromResponse (const QString &response)
void createCacheEntry (const QString &mimetype, time_t expireDate)
QString createNegotiateAuth ()
void davParseActiveLocks (const QDomNodeList &activeLocks, uint &lockCount)
void davParsePropstats (const QDomNodeList &propstats, KIO::UDSEntry &entry)
QString davProcessLocks ()
void davSetRequest (const QByteArray &requestXML)
void davStatList (const KUrl &url, bool stat=true)
void fillPromptInfo (KIO::AuthInfo *info)
QString findCookies (const QString &url)
void fixupResponseMimetype ()
QString formatRequestUri () const
void forwardHttpResponseHeader ()
QByteArray gssError (int major_status, int minor_status)
void httpClose (bool keepAlive)
void httpCloseConnection ()
bool httpOpenConnection ()
bool httpShouldCloseConnection ()
void parseContentDisposition (const QString &disposition)
long parseDateTime (const QString &input, const QString &type)
void proceedUntilResponseContent (bool dataInternal=false)
bool proceedUntilResponseHeader ()
bool readBody (bool dataInternal=false)
size_t readBuffered (char *buf, size_t size)
int readChunked ()
bool readDelimitedText (char *buf, int *idx, int end, int numNewlines)
bool readHeaderFromCache ()
int readLimited ()
bool readResponseHeader ()
int readUnlimited ()
void resetConnectionSettings ()
void resetResponseParsing ()
void resetSessionSettings ()
bool satisfyRequestFromCache (bool *success)
bool sendBody ()
bool sendQuery ()
void unread (char *buf, size_t size)
void updateExpireDate (time_t expireDate, bool updateCreationDate=false)
ssize_t write (const void *buf, size_t nbytes)
void writeCacheEntry (const char *buffer, int nbytes)

Protected Attributes

QStringList m_contentEncodings
QString m_contentMD5
bool m_cpMimeBuffer
bool m_dataInternal
QStringList m_davCapabilities
bool m_davHostOk
bool m_davHostUnsupported
quint16 m_defaultPort
KIO::filesize_t m_iBytesLeft
KIO::filesize_t m_iContentLeft
bool m_isBusy
bool m_isChunked
bool m_isEOD
bool m_isEOF
bool m_isError
bool m_isFirstRequest
KIO::filesize_t m_iSize
bool m_isRedirection
int m_maxCacheAge
long m_maxCacheSize
QString m_mimeType
QByteArray m_mimeTypeBuffer
QByteArray m_POSTbuf
QByteArray m_protocol
KAbstractHttpAuthentication * m_proxyAuth
QByteArray m_receiveBuf
int m_remoteRespTimeout
HTTPRequest m_request
QList< HTTPRequest > m_requestQueue
QStringList m_responseHeaders
HTTPServerState m_server
QAuthenticator * m_socketProxyAuth
QString m_strCacheDir
QStringList m_transferEncodings
QByteArray m_unreadBuf
QByteArray m_webDavDataBuf
KAbstractHttpAuthentication * m_wwwAuth

Detailed Description

Definition at line 56 of file http.h.


Member Enumeration Documentation

enum HTTPProtocol::AUTH_SCHEME

Authorization method used.

Enumerator:
AUTH_None 
AUTH_Basic 
AUTH_NTLM 
AUTH_Digest 
AUTH_Negotiate 

Definition at line 68 of file http.h.

enum HTTPProtocol::HTTP_REV

HTTP version.

Enumerator:
HTTP_None 
HTTP_Unknown 
HTTP_10 
HTTP_11 
SHOUTCAST 

Definition at line 65 of file http.h.


Constructor & Destructor Documentation

HTTPProtocol::HTTPProtocol ( const QByteArray &  protocol,
const QByteArray &  pool,
const QByteArray &  app 
)

Definition at line 249 of file http.cpp.

HTTPProtocol::~HTTPProtocol (  )  [virtual]

Definition at line 271 of file http.cpp.


Member Function Documentation

void HTTPProtocol::addCookies ( const QString &  url,
const QByteArray &  cookieHeader 
) [protected]

Send a cookie to the cookiejar.

Definition at line 4349 of file http.cpp.

void HTTPProtocol::addEncoding ( const QString &  _encoding,
QStringList &  encs 
) [protected]

Add an encoding on to the appropriate stack this is nececesary because transfer encodings and content encodings must be handled separately.

Definition at line 3658 of file http.cpp.

QString HTTPProtocol::authenticationHeader (  )  [protected]

Definition at line 4821 of file http.cpp.

void HTTPProtocol::cacheUpdate ( const KUrl &  url,
bool  nocache,
time_t  expireDate 
)

Definition at line 4374 of file http.cpp.

gzFile HTTPProtocol::checkCacheEntry ( bool  readWrite = false  )  [protected]

Do a cache lookup for the current url.

(m_server.url)

Parameters:
readWrite If true, file is opened read/write. If false, file is opened read-only.
Returns:
a file stream open for reading and at the start of the header section when the Cache entry exists and is valid. 0 if no cache entry could be found, or if the entry is not valid (any more).

Definition at line 4405 of file http.cpp.

void HTTPProtocol::cleanCache (  )  [protected]

Quick check whether the cache needs cleaning.

Definition at line 4738 of file http.cpp.

void HTTPProtocol::clearUnreadBuffer (  )  [protected]

Definition at line 1858 of file http.cpp.

void HTTPProtocol::closeCacheEntry (  )  [protected]

Close cache entry.

Definition at line 4713 of file http.cpp.

void HTTPProtocol::closeConnection (  )  [virtual]

Definition at line 3784 of file http.cpp.

int HTTPProtocol::codeFromResponse ( const QString &  response  )  [protected]

Returns the error code from a "HTTP/1.1 code Code Name" string.

Definition at line 817 of file http.cpp.

void HTTPProtocol::copy ( const KUrl &  src,
const KUrl &  dest,
int  _permissions,
KIO::JobFlags  flags 
) [virtual]

Definition at line 1275 of file http.cpp.

void HTTPProtocol::createCacheEntry ( const QString &  mimetype,
time_t  expireDate 
) [protected]

Create a cache entry for the current url.

(m_server.url)

Set the contents type of the cache entry to 'mimetype'.

Definition at line 4626 of file http.cpp.

QString HTTPProtocol::createNegotiateAuth (  )  [protected]

Creates the entity-header for Negotiate authentication.

QString HTTPProtocol::davError ( int  code = -1,
const QString &  url = QString() 
)

Definition at line 1461 of file http.cpp.

void HTTPProtocol::davFinished (  ) 

Definition at line 1169 of file http.cpp.

void HTTPProtocol::davGeneric ( const KUrl &  url,
KIO::HTTP_METHOD  method 
)

Definition at line 797 of file http.cpp.

bool HTTPProtocol::davHostOk (  ) 

Definition at line 1115 of file http.cpp.

void HTTPProtocol::davLock ( const KUrl &  url,
const QString &  scope,
const QString &  type,
const QString &  owner 
)

Definition at line 1377 of file http.cpp.

void HTTPProtocol::davParseActiveLocks ( const QDomNodeList &  activeLocks,
uint &  lockCount 
) [protected]

Definition at line 1002 of file http.cpp.

void HTTPProtocol::davParsePropstats ( const QDomNodeList &  propstats,
KIO::UDSEntry &  entry 
) [protected]

QString HTTPProtocol::davProcessLocks (  )  [protected]

Extracts locks from metadata Returns the appropriate If: header.

Definition at line 1066 of file http.cpp.

void HTTPProtocol::davSetRequest ( const QByteArray &  requestXML  )  [protected]

Performs a WebDAV stat or list.

Definition at line 651 of file http.cpp.

void HTTPProtocol::davStatList ( const KUrl &  url,
bool  stat = true 
) [protected]

Definition at line 657 of file http.cpp.

void HTTPProtocol::davUnlock ( const KUrl &  url  ) 

Definition at line 1441 of file http.cpp.

void HTTPProtocol::del ( const KUrl &  url,
bool  _isfile 
) [virtual]

Definition at line 1334 of file http.cpp.

void HTTPProtocol::error ( int  errid,
const QString &  text 
) [protected, slot]

Definition at line 4331 of file http.cpp.

void HTTPProtocol::fillPromptInfo ( KIO::AuthInfo *  info  )  [protected]

Creates authorization prompt info.

QString HTTPProtocol::findCookies ( const QString &  url  )  [protected]

Look for cookies in the cookiejar.

Definition at line 4357 of file http.cpp.

void HTTPProtocol::fixupResponseMimetype (  )  [protected]

Definition at line 2504 of file http.cpp.

QString HTTPProtocol::formatRequestUri (  )  const [protected]

Definition at line 2065 of file http.cpp.

void HTTPProtocol::forwardHttpResponseHeader (  )  [protected]

Definition at line 2426 of file http.cpp.

void HTTPProtocol::get ( const KUrl &  url  )  [virtual]

Definition at line 1196 of file http.cpp.

QByteArray HTTPProtocol::gssError ( int  major_status,
int  minor_status 
) [protected]

create GSS error string

void HTTPProtocol::httpClose ( bool  keepAlive  )  [protected]

Definition at line 3747 of file http.cpp.

void HTTPProtocol::httpCloseConnection (  )  [protected]

Definition at line 3790 of file http.cpp.

void HTTPProtocol::httpError (  ) 

Definition at line 1666 of file http.cpp.

bool HTTPProtocol::httpOpenConnection (  )  [protected]

Definition at line 1974 of file http.cpp.

bool HTTPProtocol::httpShouldCloseConnection (  )  [protected]

Definition at line 1938 of file http.cpp.

bool HTTPProtocol::isOffline ( const KUrl &  url  ) 

Definition at line 1730 of file http.cpp.

void HTTPProtocol::listDir ( const KUrl &  url  )  [virtual]

Definition at line 640 of file http.cpp.

bool HTTPProtocol::maybeSetRequestUrl ( const KUrl &  u  ) 

Definition at line 500 of file http.cpp.

void HTTPProtocol::mimetype ( const KUrl &  url  )  [virtual]

Definition at line 3810 of file http.cpp.

void HTTPProtocol::mkdir ( const KUrl &  url,
int  _permissions 
) [virtual]

Definition at line 1176 of file http.cpp.

void HTTPProtocol::multiGet ( const QByteArray &  data  ) 

Definition at line 1749 of file http.cpp.

void HTTPProtocol::parseContentDisposition ( const QString &  disposition  )  [protected]

Definition at line 3625 of file http.cpp.

long HTTPProtocol::parseDateTime ( const QString &  input,
const QString &  type 
) [protected]

Parses a date & time string.

Definition at line 1047 of file http.cpp.

void HTTPProtocol::post ( const KUrl &  url  ) 

Definition at line 1363 of file http.cpp.

void HTTPProtocol::proceedUntilResponseContent ( bool  dataInternal = false  )  [protected]

Do everything proceedUntilResponseHeader does, and also get the response body.

This is being used as a replacement for proceedUntilResponseHeader() in situations where we actually expect the response to have a body / payload data.

Definition at line 532 of file http.cpp.

bool HTTPProtocol::proceedUntilResponseHeader (  )  [protected]

Ensure we are connected, send our query, and get the response header.

Definition at line 553 of file http.cpp.

void HTTPProtocol::proxyAuthenticationForSocket ( const QNetworkProxy &  proxy,
QAuthenticator *  authenticator 
) [protected, slot]

Definition at line 4997 of file http.cpp.

void HTTPProtocol::put ( const KUrl &  url,
int  _mode,
KIO::JobFlags  flags 
) [virtual]

Definition at line 1215 of file http.cpp.

bool HTTPProtocol::readBody ( bool  dataInternal = false  )  [protected]

This function is our "receive" function.

It is responsible for downloading the message (not the header) from the HTTP server. It is called either as a response to a client's KIOJob::dataEnd() (meaning that the client is done sending data) or by 'sendQuery()' (if we are in the process of a PUT/POST request). It can also be called by a webDAV function, to receive stat/list/property/etc. data; in this case the data is stored in m_webDavDataBuf.

Definition at line 4093 of file http.cpp.

size_t HTTPProtocol::readBuffered ( char *  buf,
size_t  size 
) [protected]

Definition at line 1877 of file http.cpp.

int HTTPProtocol::readChunked (  )  [protected]

Read a chunk from the data stream.

Definition at line 3891 of file http.cpp.

bool HTTPProtocol::readDelimitedText ( char *  buf,
int *  idx,
int  end,
int  numNewlines 
) [protected]

Definition at line 1904 of file http.cpp.

bool HTTPProtocol::readHeaderFromCache (  )  [protected]

Definition at line 2436 of file http.cpp.

int HTTPProtocol::readLimited (  )  [protected]

Definition at line 3962 of file http.cpp.

bool HTTPProtocol::readResponseHeader (  )  [protected]

This function will read in the return header from the server.

It will not read in the body of the return message. It will also not transmit the header to our client as the client doesn't need to know the gory details of HTTP headers.

Definition at line 2554 of file http.cpp.

int HTTPProtocol::readUnlimited (  )  [protected]

Definition at line 3984 of file http.cpp.

void HTTPProtocol::rename ( const KUrl &  src,
const KUrl &  dest,
KIO::JobFlags  flags 
) [virtual]

Definition at line 1305 of file http.cpp.

void HTTPProtocol::reparseConfiguration (  )  [virtual]

Definition at line 276 of file http.cpp.

void HTTPProtocol::resetConnectionSettings (  )  [protected]

Resets any per connection settings.

These are different from per-session settings in that they must be invalidated every time a request is made, e.g. a retry to re-send the header to the server, as compared to only when a new request arrives.

Definition at line 292 of file http.cpp.

void HTTPProtocol::resetResponseParsing (  )  [protected]

Resets variables related to parsing a response.

Definition at line 298 of file http.cpp.

void HTTPProtocol::resetSessionSettings (  )  [protected]

Resets any per session settings.

Definition at line 314 of file http.cpp.

bool HTTPProtocol::satisfyRequestFromCache ( bool *  success  )  [protected]

Definition at line 2008 of file http.cpp.

void HTTPProtocol::saveProxyAuthenticationForSocket (  )  [protected, slot]

Definition at line 5043 of file http.cpp.

bool HTTPProtocol::sendBody (  )  [protected]

Definition at line 3684 of file http.cpp.

bool HTTPProtocol::sendQuery (  )  [protected]

This function is responsible for opening up the connection to the remote HTTP server and sending the header.

If this requires special authentication or other such fun stuff, then it will handle it. This function will NOT receive anything from the server, however. This is in contrast to previous incarnations of 'httpOpen' as this method used to be called.

The basic process now is this:

1) Open up the socket and port 2) Format our request/header 3) Send the header to the remote server 4) Call sendBody() if the HTTP method requires sending body data

Definition at line 2106 of file http.cpp.

void HTTPProtocol::setHost ( const QString &  host,
quint16  port,
const QString &  user,
const QString &  pass 
) [virtual]

Definition at line 470 of file http.cpp.

void HTTPProtocol::slave_status (  )  [virtual]

Definition at line 3800 of file http.cpp.

void HTTPProtocol::slotData ( const QByteArray &  _d  )  [protected, slot]

Definition at line 4003 of file http.cpp.

void HTTPProtocol::special ( const QByteArray &  data  )  [virtual]

Special commands supported by this slave : 1 - HTTP POST 2 - Cache has been updated 3 - SSL Certificate Cache has been updated 4 - HTTP multi get 5 - DAV LOCK (see 6 - DAV UNLOCK README.webdav).

Definition at line 3828 of file http.cpp.

void HTTPProtocol::stat ( const KUrl &  url  )  [virtual]

Definition at line 608 of file http.cpp.

void HTTPProtocol::unread ( char *  buf,
size_t  size 
) [protected]

Definition at line 1863 of file http.cpp.

void HTTPProtocol::updateExpireDate ( time_t  expireDate,
bool  updateCreationDate = false 
) [protected]

Update expire time of current cache entry.

Definition at line 4568 of file http.cpp.

ssize_t HTTPProtocol::write ( const void *  buf,
size_t  nbytes 
) [protected]

A thin wrapper around TCPSlaveBase::write() that will retry writing as long as no error occurs.

Definition at line 1839 of file http.cpp.

void HTTPProtocol::writeCacheEntry ( const char *  buffer,
int  nbytes 
) [protected]

Write data to cache.

Write 'nbytes' from 'buffer' to the Cache Entry File

Definition at line 4686 of file http.cpp.


Member Data Documentation

QStringList HTTPProtocol::m_contentEncodings [protected]

Definition at line 472 of file http.h.

QString HTTPProtocol::m_contentMD5 [protected]

Definition at line 473 of file http.h.

bool HTTPProtocol::m_cpMimeBuffer [protected]

Definition at line 487 of file http.h.

bool HTTPProtocol::m_dataInternal [protected]

Definition at line 455 of file http.h.

QStringList HTTPProtocol::m_davCapabilities [protected]

Definition at line 480 of file http.h.

bool HTTPProtocol::m_davHostOk [protected]

Definition at line 482 of file http.h.

bool HTTPProtocol::m_davHostUnsupported [protected]

Definition at line 483 of file http.h.

quint16 HTTPProtocol::m_defaultPort [protected]

Definition at line 448 of file http.h.

KIO::filesize_t HTTPProtocol::m_iBytesLeft [protected]

Definition at line 452 of file http.h.

KIO::filesize_t HTTPProtocol::m_iContentLeft [protected]

Definition at line 453 of file http.h.

bool HTTPProtocol::m_isBusy [protected]

Definition at line 458 of file http.h.

bool HTTPProtocol::m_isChunked [protected]

Definition at line 456 of file http.h.

bool HTTPProtocol::m_isEOD [protected]

Definition at line 460 of file http.h.

bool HTTPProtocol::m_isEOF [protected]

Definition at line 459 of file http.h.

bool HTTPProtocol::m_isError [protected]

Definition at line 525 of file http.h.

bool HTTPProtocol::m_isFirstRequest [protected]

Definition at line 463 of file http.h.

KIO::filesize_t HTTPProtocol::m_iSize [protected]

Definition at line 451 of file http.h.

bool HTTPProtocol::m_isRedirection [protected]

Definition at line 466 of file http.h.

int HTTPProtocol::m_maxCacheAge [protected]

Definition at line 497 of file http.h.

long HTTPProtocol::m_maxCacheSize [protected]

Definition at line 498 of file http.h.

QString HTTPProtocol::m_mimeType [protected]

Definition at line 474 of file http.h.

QByteArray HTTPProtocol::m_mimeTypeBuffer [protected]

Definition at line 488 of file http.h.

QByteArray HTTPProtocol::m_POSTbuf [protected]

Definition at line 494 of file http.h.

QByteArray HTTPProtocol::m_protocol [protected]

Definition at line 505 of file http.h.

KAbstractHttpAuthentication* HTTPProtocol::m_proxyAuth [protected]

Definition at line 520 of file http.h.

QByteArray HTTPProtocol::m_receiveBuf [protected]

Definition at line 454 of file http.h.

int HTTPProtocol::m_remoteRespTimeout [protected]

Definition at line 528 of file http.h.

HTTPRequest HTTPProtocol::m_request [protected]

Definition at line 446 of file http.h.

QList<HTTPRequest> HTTPProtocol::m_requestQueue [protected]

Definition at line 447 of file http.h.

QStringList HTTPProtocol::m_responseHeaders [protected]

Definition at line 467 of file http.h.

HTTPServerState HTTPProtocol::m_server [protected]

Definition at line 445 of file http.h.

QAuthenticator* HTTPProtocol::m_socketProxyAuth [protected]

Definition at line 522 of file http.h.

QString HTTPProtocol::m_strCacheDir [protected]

Definition at line 499 of file http.h.

QStringList HTTPProtocol::m_transferEncodings [protected]

Definition at line 471 of file http.h.

QByteArray HTTPProtocol::m_unreadBuf [protected]

Definition at line 531 of file http.h.

QByteArray HTTPProtocol::m_webDavDataBuf [protected]

Definition at line 479 of file http.h.

KAbstractHttpAuthentication* HTTPProtocol::m_wwwAuth [protected]

Definition at line 519 of file http.h.


The documentation for this class was generated from the following files:
  • http.h
  • http.cpp

KIOSlave

Skip menu "KIOSlave"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal