HTTPProtocol Class Reference

Inheritance diagram for HTTPProtocol:

QObject List of all members.

Detailed Description

Definition at line 49 of file http.h.


Public Types

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

Public Member Functions

 HTTPProtocol (const QCString &protocol, const QCString &pool, const QCString &app)
virtual ~HTTPProtocol ()
virtual void setHost (const QString &host, int port, const QString &user, const QString &pass)
virtual void slave_status ()
virtual void get (const KURL &url)
virtual void put (const KURL &url, int permissions, bool overwrite, bool resume)
virtual void listDir (const KURL &url)
virtual void mkdir (const KURL &url, int permissions)
virtual void rename (const KURL &src, const KURL &dest, bool overwrite)
virtual void copy (const KURL &src, const KURL &dest, int permissions, bool overwrite)
virtual void del (const KURL &url, bool isfile)
bool davHostOk ()
void davGeneric (const KURL &url, KIO::HTTP_METHOD method)
void davLock (const KURL &url, const QString &scope, const QString &type, const QString &owner)
void davUnlock (const KURL &url)
void davFinished ()
QString davError (int code=-1, QString url=QString::null)
virtual void special (const QByteArray &data)
virtual void mimetype (const KURL &url)
virtual void stat (const KURL &url)
virtual void reparseConfiguration ()
virtual void closeConnection ()
void post (const KURL &url)
void multiGet (const QByteArray &data)
bool checkRequestURL (const KURL &)
void cacheUpdate (const KURL &url, bool nocache, time_t expireDate)
void httpError ()
bool isOffline (const KURL &url)

Protected Slots

void slotData (const QByteArray &)
void error (int _errid, const QString &_text)

Protected Member Functions

int readChunked ()
int readLimited ()
int readUnlimited ()
ssize_t write (const void *buf, size_t nbytes)
ssize_t read (void *b, size_t nbytes)
char * gets (char *str, int size)
void setRewindMarker ()
void rewind ()
void addEncoding (QString, QStringList &)
void configAuth (char *, bool)
bool httpOpen ()
void httpClose (bool keepAlive)
bool httpOpenConnection ()
void httpCloseConnection ()
void httpCheckConnection ()
void forwardHttpResponseHeader ()
bool readHeader ()
bool sendBody ()
bool readBody (bool dataInternal=false)
void davSetRequest (const QCString &requestXML)
void davStatList (const KURL &url, bool stat=true)
void davParsePropstats (const QDomNodeList &propstats, KIO::UDSEntry &entry)
void davParseActiveLocks (const QDomNodeList &activeLocks, uint &lockCount)
long parseDateTime (const QString &input, const QString &type)
int codeFromResponse (const QString &response)
QString davProcessLocks ()
void addCookies (const QString &url, const QCString &cookieHeader)
QString findCookies (const QString &url)
FILE * checkCacheEntry (bool readWrite=false)
void createCacheEntry (const QString &mimetype, time_t expireDate)
void writeCacheEntry (const char *buffer, int nbytes)
void closeCacheEntry ()
void updateExpireDate (time_t expireDate, bool updateCreationDate=false)
void cleanCache ()
void retrieveContent (bool dataInternal=false)
bool retrieveHeader (bool close_connection=true)
void resetSessionSettings ()
void resetResponseSettings ()
void resetConnectionSettings ()
QString proxyAuthenticationHeader ()
bool getAuthorization ()
void saveAuthorization ()
QString createBasicAuth (bool isForProxy=false)
QString createDigestAuth (bool isForProxy=false)
QString createNTLMAuth (bool isForProxy=false)
QString createNegotiateAuth ()
QCString gssError (int major_status, int minor_status)
void calculateResponse (DigestAuthInfo &info, QCString &Response)
bool retryPrompt ()
void promptInfo (KIO::AuthInfo &info)

Protected Attributes

HTTPState m_state
HTTPRequest m_request
QPtrList< HTTPRequestm_requestQueue
bool m_bBusy
bool m_bEOF
bool m_bEOD
QStringList m_responseHeader
KURL m_redirectLocation
bool m_bRedirect
bool m_bChunked
KIO::filesize_t m_iSize
KIO::filesize_t m_iBytesLeft
KIO::filesize_t m_iContentLeft
QByteArray m_bufReceive
bool m_dataInternal
char m_lineBuf [1024]
char m_rewindBuf [4096]
size_t m_rewindCount
char * m_linePtr
size_t m_lineCount
char * m_lineBufUnget
char * m_linePtrUnget
size_t m_lineCountUnget
bool m_cpMimeBuffer
QByteArray m_mimeTypeBuffer
QStringList m_qTransferEncodings
QStringList m_qContentEncodings
QString m_sContentMD5
QString m_strMimeType
QByteArray m_bufWebDavData
QStringList m_davCapabilities
bool m_davHostOk
bool m_davHostUnsupported
QByteArray m_bufPOST
int m_maxCacheAge
long m_maxCacheSize
QString m_strCacheDir
bool m_bUseProxy
bool m_bNeedTunnel
bool m_bIsTunneled
bool m_bProxyAuthValid
int m_iProxyPort
KURL m_proxyURL
QString m_strProxyRealm
QCString m_protocol
QString m_strRealm
QString m_strAuthorization
QString m_strProxyAuthorization
HTTP_AUTH Authentication
HTTP_AUTH ProxyAuthentication
bool m_bUnauthorized
short unsigned int m_iProxyAuthCount
short unsigned int m_iWWWAuthCount
bool m_bFirstRequest
bool m_bKeepAlive
int m_keepAliveTimeout
bool m_bPersistentProxyConnection
bool m_bError
unsigned int m_responseCode
unsigned int m_prevResponseCode
int m_proxyConnTimeout
int m_remoteConnTimeout
int m_remoteRespTimeout
int m_pid

Classes

struct  DAVRequest
 DAV-specific request elements for the current connection. More...
struct  DigestAuthInfo
struct  HTTPRequest
 The request for the current connection. More...
struct  HTTPState
 State of the current Connection. More...

Member Enumeration Documentation

HTTP version.

Definition at line 58 of file http.h.

Authorization method used.

Definition at line 61 of file http.h.


Member Function Documentation

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 4036 of file http.cc.

int HTTPProtocol::readChunked (  )  [protected]

Read a chunk from the data stream.

Definition at line 4099 of file http.cc.

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

A "smart" wrapper around write that will use SSL_write or write(2) depending on whether you've got an SSL connection or not.

The only shortcomming is that it uses the "global" file handles and soforth. So you can't really use this on individual files/sockets.

Definition at line 1879 of file http.cc.

ssize_t HTTPProtocol::read ( void *  b,
size_t  nbytes 
) [protected]

Another "smart" wrapper, this time around read that will use SSL_read or read(2) depending on whether you've got an SSL connection or not.

Definition at line 1949 of file http.cc.

void HTTPProtocol::addEncoding ( QString  ,
QStringList  
) [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 3851 of file http.cc.

bool HTTPProtocol::httpOpen (  )  [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'.

The reason for the change is due to one small fact: some requests require data to be sent in addition to the header (POST requests) and there is no way for this function to get that data. This function is called in the slotPut() or slotGet() functions which, in turn, are called (indirectly) as a result of a KIOJob::put() or KIOJob::get(). It is those latter functions which are responsible for starting up this ioslave in the first place. This means that 'httpOpen' is called (essentially) as soon as the ioslave is created -- BEFORE any data gets to this slave.

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

Definition at line 2158 of file http.cc.

bool HTTPProtocol::readHeader (  )  [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 2662 of file http.cc.

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 'httpOpen()' (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_bufWebDavData.

Definition at line 4302 of file http.cc.

void HTTPProtocol::davSetRequest ( const QCString requestXML  )  [protected]

Performs a WebDAV stat or list.

Definition at line 657 of file http.cc.

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

Parses a date & time string.

Definition at line 1077 of file http.cc.

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

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

Definition at line 829 of file http.cc.

QString HTTPProtocol::davProcessLocks (  )  [protected]

Extracts locks from metadata Returns the appropriate If: header.

Definition at line 1096 of file http.cc.

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

Send a cookie to the cookiejar.

Definition at line 4560 of file http.cc.

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

Look for cookies in the cookiejar.

Definition at line 4577 of file http.cc.

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

Do a cache lookup for the current url.

(m_state.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 4642 of file http.cc.

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

Create a cache entry for the current url.

(m_state.url)

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

Definition at line 4840 of file http.cc.

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 4899 of file http.cc.

void HTTPProtocol::closeCacheEntry (  )  [protected]

Close cache entry.

Definition at line 4923 of file http.cc.

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

Update expire time of current cache entry.

Definition at line 4782 of file http.cc.

void HTTPProtocol::cleanCache (  )  [protected]

Quick check whether the cache needs cleaning.

Definition at line 4942 of file http.cc.

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

Performs a GET HTTP request.

Definition at line 494 of file http.cc.

bool HTTPProtocol::retrieveHeader ( bool  close_connection = true  )  [protected]

Performs a HEAD HTTP request.

Definition at line 522 of file http.cc.

void HTTPProtocol::resetSessionSettings (  )  [protected]

Resets any per session settings.

Definition at line 275 of file http.cc.

void HTTPProtocol::resetResponseSettings (  )  [protected]

Resets settings related to parsing a response.

Definition at line 259 of file http.cc.

void HTTPProtocol::resetConnectionSettings (  )  [protected]

Resets any per connection settings.

These are different from per-session settings in that they must be invalidates 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 248 of file http.cc.

QString HTTPProtocol::proxyAuthenticationHeader (  )  [protected]

Returns any pre-cached proxy authentication info info in HTTP header format.

Definition at line 5985 of file http.cc.

bool HTTPProtocol::getAuthorization (  )  [protected]

Retrieves authorization info from cache or user.

Definition at line 5170 of file http.cc.

void HTTPProtocol::saveAuthorization (  )  [protected]

Saves valid authorization info in the cache daemon.

Definition at line 5396 of file http.cc.

QString HTTPProtocol::createBasicAuth ( bool  isForProxy = false  )  [protected]

Creates the entity-header for Basic authentication.

Definition at line 5614 of file http.cc.

QString HTTPProtocol::createDigestAuth ( bool  isForProxy = false  )  [protected]

Creates the entity-header for Digest authentication.

Definition at line 5711 of file http.cc.

QString HTTPProtocol::createNTLMAuth ( bool  isForProxy = false  )  [protected]

Creates the entity-header for NTLM authentication.

Definition at line 5556 of file http.cc.

QString HTTPProtocol::createNegotiateAuth (  )  [protected]

Creates the entity-header for Negotiate authentication.

Definition at line 5550 of file http.cc.

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

create GSS error string

Definition at line 5544 of file http.cc.

void HTTPProtocol::calculateResponse ( DigestAuthInfo info,
QCString Response 
) [protected]

Calcualtes the message digest response based on RFC 2617.

Definition at line 5644 of file http.cc.

bool HTTPProtocol::retryPrompt (  )  [protected]

Prompts the user for authorization retry.

Definition at line 5113 of file http.cc.

void HTTPProtocol::promptInfo ( KIO::AuthInfo &  info  )  [protected]

Creates authorization prompt info.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys