34 #include <ptlib_config.h>
147 PBoolean SetSize(PINDEX) {
return false; }
287 virtual void *
GetBuffer(PINDEX & size) = 0;
288 virtual bool Process(
const void * , PINDEX ) {
return true; }
335 PString AsHex(
const PMessageDigest::Result & digest)
const {
return digest.AsHex(); }
720 {
return PutDocument(url, document, contentType); }
739 void SetSSLCredentials(
756 unsigned maxRedirects
763 static PINDEX MaxTraceContentSize;
831 virtual bool Connect(
834 PString * selectedProtocol = NULL
839 virtual bool ReadMessage(
844 virtual bool ReadText(
849 bool IsMessageComplete()
const;
857 void SetWriteFragmentation(
859 ) { m_fragmentingWrite = frag; }
864 ) { m_binaryWrite = bin; }
869 ) { m_binaryWrite = !txt; }
871 void SetSSLCredentials(
884 ConnectionClose = 0x8,
889 virtual bool ReadHeader(
892 uint64_t & payloadLength,
896 virtual bool WriteHeader(
899 uint64_t payloadLength,
903 bool InternalRead(
void * buf, PINDEX len);
904 bool ReadMasked(
void * buf, PINDEX len);
906 bool InternalWrite(OpCodes opCode,
bool fragmenting,
const void * data, PINDEX len);
907 bool WriteMasked(
const uint32_t * data, PINDEX len, uint32_t mask);
910 bool m_fragmentingWrite;
914 uint64_t m_remainingPayload;
915 int64_t m_currentMask;
916 bool m_fragmentedRead;
918 bool m_recursiveRead;
1300 void SwitchToWebSocket(
const PString & protocol,
const PString & key);
1333 unsigned maxWorkers = 10
1344 unsigned queueSize = 10
1350 unsigned queueSize = 10
1962 PHTML & replyMessage
2404 #endif // PTLIB_HTTP_H
static const PCaselessString & TransferEncodingTag()
void SetPersistenceMaximumTransations(unsigned m)
Set the maximum number of transations (GET/POST etc) for persistent connection.
Definition: http.h:981
PString commandName
Definition: http.h:999
void SetMIME(const PString &tag, const PString &value)
void SetString(const PString &str)
Set the string to be returned by this resource.
Definition: http.h:2080
PHTTPListener(unsigned maxWorkers=10)
Construct new HTTP listsner with specified maximum number of threads in pool.
virtual PBoolean Post(PHTTPRequest &request, const PStringToString &data, PHTML &replyMessage)
Get a block of data (eg HTML) that the resource contains.
virtual PString GetPassword() const
Definition: http.h:327
virtual PBoolean Parse(const PString &auth, PBoolean proxy)
virtual void SetPassword(const PString &pass)
Definition: http.h:331
void ClearWebSocketNotifier(const PString &protocol)
Remove a WebSocket notifier.
virtual PMIMEInfo & GetMIME()=0
PString AsHex(const PMessageDigest::Result &digest) const
Definition: http.h:335
const PString & GetPassword() const
Get the password allocated to this simple authorisation.
Definition: http.h:1582
static const PCaselessString & ContentTypeTag()
bool DecodeMultiPartList(PMultiPartList &parts, const PString &body, const PCaselessString &key) const
Decode parts from a multipart body using the field value.
PBoolean Initialise(PHTTPServer &server, PString &args)
bool GetPersistent() const
Get persistent connection mode.
Definition: http.h:752
This class contains the Multipurpose Internet Mail Extensions parameters and variables.
Definition: mime.h:48
virtual bool SupportsWebSocketProtocol(const PString &protocol) const
Indicate that the web socket protocol is supported by this resource.
static const PCaselessString & FormUrlEncoded()
static const PCaselessString & ExpiresTag()
WORD m_listenerPort
Definition: http.h:1401
virtual bool OnHEAD(PHTTPServer &server, const PHTTPConnectionInfo &conInfo)
Handle the HEAD command passed from the HTTP socket.
This object describes the information associated with multi-part bodies.
Definition: mime.h:327
PString entityBody
Definition: http.h:1008
const PString & GetNonce() const
Definition: http.h:423
PFile m_file
Definition: http.h:2209
PString m_password
Definition: http.h:1588
virtual PBoolean IsActive() const
Determine if the authorisation is to be applied.
301 - resource moved permanently: location field has new URL
Definition: http.h:193
This class represents a disk file.
Definition: file.h:57
bool StartResponse(StatusCode code, PMIMEInfo &headers, long bodySize)
Write a command reply back to the client, and construct some of the outgoing MIME fields...
virtual PBoolean IsProxy() const
Definition: http.h:324
bool DeleteDocument(const PURL &url)
Delete the document specified by the URL.
PHTTPClientAuthenticator(const PString &cmdName, const PString &uri, PMIMEInfo &mime, PHTTPContentProcessor &processor)
PDECLARE_MUTEX(px_threadMutex)
static const PCaselessString & CookieTag()
PHTTPClientDigestAuthentication & operator=(const PHTTPClientDigestAuthentication &auth)
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
virtual void * GetBuffer(PINDEX &size)=0
1 = response is malformed
Definition: http.h:177
bool WasPersistent() const
Definition: http.h:954
static const PCaselessString & AuthorizationTag()
void EndRead() const
This function attempts to release the mutex for reading.
Definition: http.h:115
Array of characters.
Definition: array.h:552
412 - no Range header for true Unless
Definition: http.h:210
virtual PString GetRealm(const PHTTPRequest &request) const
Get the realm or name space for the user authorisation name and password as required by the basic aut...
PHTTPServer()
Create a TCP/IP HTTP protocol socket channel.
virtual PString GetRealm(const PHTTPRequest &request) const
Get the realm or name space for the user authorisation name and password as required by the basic aut...
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
void EnableAuthorisation(const PString &realm)
Enable or disable access control using .access files.
virtual PBoolean Authorise(AuthObject &pdu) const
PString m_uri
Definition: http.h:364
~PHTTPListener()
Shut down all listeners on destruction.
500 - server has encountered an unexpected error
Definition: http.h:211
static const PCaselessString & LocationTag()
void DisablePersistence()
Do not persist.
Definition: http.h:963
PBoolean CheckAuthority(PHTTPServer &server, const PHTTPRequest &request, const PHTTPConnectionInfo &conInfo)
See if the resource is authorised given the mime info.
virtual PBoolean LoadData(PHTTPRequest &request, PCharArray &data)
Get a block of data that the resource contains.
PSORTED_LIST(ChildList, Node)
PHTTPAuthority * GetAuthority() const
Get the current authority for the resource.
Definition: http.h:1734
This class describes the simplest authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1505
PHTTPResource * resource
Definition: http.h:143
PHTTPContentProcessor & m_contentProcessor
Definition: http.h:366
void ClearHitCount()
Clear the hit count for the resource.
Definition: http.h:1755
static const PCaselessString & RefererTag()
bool IsProxyConnection() const
Definition: http.h:955
PFilePath m_realPath
Definition: http.h:2398
PTCPSocket * m_socket
Definition: http.h:1382
const PTime & GetLastCommandTime() const
Get time last command was read.
Definition: http.h:1295
This abstract class describes the authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1452
This class defines an absolute time and date.
Definition: ptime.h:49
virtual PObject * Clone() const
Create a copy of the class on the heap.
bool PutDocument(const PURL &url, const PString &document, const PString &contentType=PMIMEInfo::TextPlain(), const PMIMEInfo &mime=PMIMEInfo())
Put the document specified by the URL.
static const PCaselessString & PragmaNoCacheTag()
static const PCaselessString & WWWAuthenticateTag()
PHTTPContentProcessor(bool reader)
Definition: http.h:285
PString m_realm
Definition: http.h:1669
virtual void SetUsername(const PString &user)
Definition: http.h:330
503 - server temporarily unable to service request
Definition: http.h:214
PTimeInterval m_nextTimeout
Definition: http.h:1308
P_REMOVE_VIRTUAL(PBoolean, OnGET(const PURL &, const PMIMEInfo &, const PHTTPConnectionInfo &), false)
unsigned GetMaxRedirects() const
Get max redirects on operation.
Definition: http.h:760
int ExecuteCommand(Commands cmd, const PURL &url, PMIMEInfo &outMIME, const PString &dataBody, PMIMEInfo &replyMime)
Send a command and wait for the response header (including MIME fields).
virtual PString LoadText(PHTTPRequest &request)
Get a block of text data (eg HTML) that the resource contains.
const PString & GetContentType() const
Get the current content type for the resource.
Definition: http.h:1726
Algorithm
Definition: http.h:419
void SetAuthority(const PHTTPAuthority &auth)
Set the current authority for the resource.
const PMultiPartList & multipartFormInfo
multipart form information, if any
Definition: http.h:1433
static const PCaselessString & ContentLengthTag()
static const PCaselessString & ProxyConnectionTag()
virtual Comparison Compare(const PObject &other) const
Compare the two objects and return their relative rank.
203 - not definitive entity header
Definition: http.h:188
205 - contents have been reset
Definition: http.h:190
PHTTP::Commands commandCode
Definition: http.h:998
bool GetHeader(const PURL &url, PMIMEInfo &outMIME, PMIMEInfo &replyMIME)
Get the header for the document specified by the URL.
virtual PBoolean CheckAuthority(PHTTPServer &server, const PHTTPRequest &request, const PHTTPConnectionInfo &conInfo)
See if the resource is authorised given the mime info.
Generate error if resource already exists.
Definition: http.h:66
virtual PString GetServerName() const
Get the name of the server.
303 - see other URL
Definition: http.h:195
PHTTPFileRequest(const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPResource *resource, PHTTPServer &server)
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:3151
This class describes a full description for a file on the particular platform.
Definition: filepath.h:61
void SetServiceStartTime(const PTime &startTime)
Set start of service time.
Definition: http.h:1289
static const PCaselessString & SetCookieTag()
PBoolean isProxy
Definition: http.h:342
PString m_password
Definition: http.h:771
virtual Comparison Compare(const PObject &other) const
Compare the two objects and return their relative rank.
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
void SetMaxRedirects(unsigned maxRedirects)
Set max redirects on operation.
Definition: http.h:755
void AddUser(const PString &username, const PString &password)
Get the user name allocated to this simple authorisation.
PHTTPResource * FindResource(const PURL &url)
Locate the resource specified by the URL in the URL name space.
static const PCaselessString & ContentEncodingTag()
virtual PBoolean Validate(const PHTTPRequest &request, const PString &authInfo) const
Validate the user and password provided by the remote HTTP client for the realm specified by the clas...
virtual bool OnGET(PHTTPServer &server, const PHTTPConnectionInfo &conInfo)
Handle the GET command passed from the HTTP socket.
This is a channel that operates indirectly through another channel(s).
Definition: indchan.h:45
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
virtual PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
std::map< std::string, WebSocketNotifier > WebSocketNotifierMap
Definition: http.h:1310
PMIMEInfo & m_mime
Definition: http.h:365
PTime m_lastCommandTime
Definition: http.h:1304
PString m_userAgentName
Definition: http.h:767
virtual bool OnWebSocket(PHTTPConnectionInfo &connectInfo)
Called when a request indicates a swtch to WebSocket protocol.
PHTTPSpace & GetURLSpace()
Get the name space being used by the HTTP server socket.
Definition: http.h:1073
static const PCaselessString & WebSocketProtocolTag()
void EndWrite() const
This function attempts to release the mutex for writing.
Definition: http.h:125
virtual void SetAuthRealm(const PString &r)
Definition: http.h:417
static const PCaselessString & ServerTag()
void ShutdownListeners()
Shut down the listener socket, it's thread, and all threads in the pool.
ThreadPool & GetThreadPool()
Definition: http.h:1390
PBoolean AddResource(PHTTPResource *resource, AddOptions overwrite=ErrorOnExist)
Add a new resource to the URL space.
bool wasPersistent
Definition: http.h:1003
unsigned m_transactionCount
Definition: http.h:1307
virtual PObject * Clone() const
Create a copy of the class on the heap.
bool stale
Definition: http.h:436
Overwrite the existing resource at URL location.
Definition: http.h:67
void StartRead() const
This function attempts to acquire the mutex for reading.
Definition: http.h:110
static const PCaselessString & ProxyAuthorizationTag()
PHTTPConnectionInfo m_connectInfo
Definition: http.h:1306
virtual PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
501 - server does not implement request
Definition: http.h:212
virtual bool Process(const void *, PINDEX)
Definition: http.h:288
virtual PBoolean IsActive() const
Determine if the authorisation is to be applied.
__inline void StartWrite()
This function attempts to acquire the mutex for writing.
Definition: syncthrd.h:299
PString entityBody
original entity body (POST only)
Definition: http.h:1436
This object describes a HyperText Transport Protocol resource which is a single file.
Definition: http.h:2098
virtual PString GetAuthRealm() const
Definition: http.h:328
virtual PChannel * CreateChannelForHTTP(PChannel *channel)
Call back to create transport socket, or TLS, channel.
bool WriteCommand(Commands cmd, const PString &url, PMIMEInfo &outMIME, ContentProcessor &processor)
Write a HTTP command to server.
PString m_username
Definition: http.h:1587
Node * parent
Definition: http.h:141
200 - request has succeeded
Definition: http.h:185
This is an array collection class of PString objects.
Definition: pstring.h:2365
101 - upgrade allowed
Definition: http.h:184
int GetMajorVersion() const
Definition: http.h:956
PHTTPString(const PURL &url)
Contruct a new simple string resource for the HTTP space.
This object describes a HyperText Transport Protocol resource which is a string kept in memory...
Definition: http.h:2009
unsigned persistenceMaximum
Definition: http.h:1011
PString m_contentType
MIME content type for the resource.
Definition: http.h:1991
PHTTPClientAuthentication * m_authentication
Definition: http.h:777
const PMIMEInfo & GetMIME() const
Definition: http.h:948
virtual bool OnWebSocket(PHTTPServer &server, PHTTPConnectionInfo &connectInfo)
Called when a request indicates a swtch to WebSocket protocol.
void StartWrite() const
This function attempts to acquire the mutex for writing.
Definition: http.h:120
PThread * m_listenerThread
Definition: http.h:1402
virtual PBoolean GetExpirationDate(PTime &when)
Get a block of data (eg HTML) that the resource contains.
long GetEntityBodyLength() const
Definition: http.h:959
virtual PHTTPContentProcessor * GetContentProcessor()
Definition: http.h:305
static const PCaselessString & WebSocketKeyTag()
PHTTPServer * m_httpServer
Definition: http.h:1383
unsigned persistenceSeconds
Definition: http.h:1010
401 - request requires authentication
Definition: http.h:199
PHTTPDirRequest(const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPResource *resource, PHTTPServer &server)
WebSocketNotifierMap m_webSocketNotifiers
Definition: http.h:1311
This object describes a HyperText Transport Protocol resource.
Definition: http.h:1680
PHTTPSimpleAuth(const PString &realm, const PString &username, const PString &password)
PHTTPSpace m_httpNameSpace
Definition: http.h:1399
PHTTPClientBasicAuthentication()
404 - resource cannot be found
Definition: http.h:202
PString defaultServiceName
Definition: inetprot.h:377
void SetURLSpace(const PHTTPSpace &space)
Use a new URL name space for this HTTP socket.
virtual Comparison Compare(const PObject &other) const
Compare the two objects and return their relative rank.
PHTTPMultiSimpAuth(const PString &realm)
virtual bool OnPOST(const PHTTPConnectionInfo &conInfo)
Handle a POST command from a client.
virtual void RemoveAll()
Remove all of the elements in the collection.
virtual void OnHTTPEnded(PHTTPServer &server)
Callback when an existing HTTP connection has ended.
static const PCaselessString & ForwardedTag()
const PString & GetOpaque() const
Definition: http.h:425
virtual PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
Could not connect transport.
Definition: http.h:180
This object describes a HyperText Transport Protocol resource which is a set of files in a directory...
Definition: http.h:2303
A TCP/IP socket for process/application layer high level protocols.
Definition: inetprot.h:61
PString GetAuthParam(const PString &auth, const char *name) const
virtual PHTTPContentProcessor * GetContentProcessor()
302 - resource moved temporarily: location field has new URL
Definition: http.h:194
bool GetDocument(const PURL &url, ContentProcessor &processor)
Start getting the document specified by the URL.
ChildList children
Definition: http.h:142
virtual PHTTPRequest * CreateRequest(const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPServer &socket)
Create a new request block for this type of resource.
long entityBodyLength
Definition: http.h:1009
bool PutTextDocument(const PURL &url, const PString &document, const PString &contentType=PMIMEInfo::TextPlain())
Definition: http.h:719
virtual PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
Class to represent a directory in the operating system file system.
Definition: pdirect.h:173
const PString & GetCommandName() const
Definition: http.h:944
402 - reserved
Definition: http.h:200
bool PostData(const PURL &url, const PStringToString &data)
Post the "application/x-www-form-urlencoded" data specified to the URL.
PHTTPConnectionInfo & GetConnectionInfo()
Get the connection info for this connection.
Definition: http.h:1235
PTime m_serviceStartTime
Definition: http.h:1303
PHTTPAuthority * m_authority
Authorisation method for the resource.
Definition: http.h:1992
static void DecodeBasicAuthority(const PString &authInfo, PString &username, PString &password)
Array of unsigned characters.
Definition: array.h:605
Node(const PString &name, Node *parentNode)
virtual PBoolean OnProxy(const PHTTPConnectionInfo &conInfo)
Handle a proxy command request from a client.
PString password
Definition: http.h:344
PHTTPClientDigestAuthentication()
const ThreadPool & GetThreadPool() const
Get the thread pool in use for this HTTP listener.
Definition: http.h:1389
405 - not allowed on this resource
Definition: http.h:203
__inline void StartRead()
This function attempts to acquire the mutex for reading.
Definition: syncthrd.h:276
410 - resource gone away
Definition: http.h:208
const PURL & url
Universal Resource Locator for document.
Definition: http.h:1431
PTimeInterval GetPersistenceTimeout() const
Get the maximum time a persistent connection may persist.
Definition: http.h:967
static const PCaselessString & WebSocketTag()
Worker(PHTTPListener &listener, PTCPSocket *socket)
virtual void OnHTTPStarted(PHTTPServer &server)
Callback when a new HTTP connection has begun.
bool DecodeMultipartFormInfo()
Definition: http.h:996
virtual PBoolean OnUnknown(const PCaselessString &command, const PHTTPConnectionInfo &connectInfo)
Handle an unknown command.
virtual PBoolean Parse(const PString &auth, PBoolean proxy)=0
The PNotifier and PNotifierFunction classes build a completely type safe mechanism for calling arbitr...
Definition: notifier.h:109
bool ListenForHTTP(WORD port, PSocket::Reusability reuse=PSocket::CanReuseAddress, unsigned queueSize=10)
Start listening for HTTP connections.
PINDEX contentSize
Size of the body of the resource data.
Definition: http.h:1437
virtual void Reset()
Definition: http.h:289
int minorVersion
Definition: http.h:1007
PHTTPClient(const PString &userAgentName=PString::Empty())
Create a new HTTP client channel.
PIPSocket::Address localAddr
IP address of local interface for request.
Definition: http.h:1439
const PString & GetString()
Get the string for this resource.
Definition: http.h:2076
PDirectory m_basePath
Definition: http.h:2379
PFilePath m_filePath
Definition: http.h:2193
A TCP/IP socket for the HyperText Transfer Protocol version 1.0.
Definition: http.h:465
const PURL & GetURL() const
Get the URL for this resource.
Definition: http.h:1715
bool m_isWebSocket
Definition: http.h:1005
Translate to a string as only path.
Definition: url.h:135
PHTTPFile(const PString &filename)
Contruct a new simple file resource for the HTTP space.
static const PCaselessString & UserAgentTag()
const PHTTPSpace & GetSpace() const
Get the resource space for HTTP listener.
Definition: http.h:1393
Unknown "Transfer-Encoding" extension.
Definition: http.h:179
static const PCaselessString & FromTag()
PDECLARE_MUTEX(m_httpServersMutex)
virtual bool OnPOST(PHTTPServer &server, const PHTTPConnectionInfo &conInfo)
Handle the POST command passed from the HTTP socket.
204 - no new information
Definition: http.h:189
Abstract class defining I/O channel semantics.
Definition: channel.h:103
virtual PString LoadText(PHTTPRequest &request)
Get a block of text data (eg HTML) that the resource contains.
static const PCaselessString & MIMEVersionTag()
bool IsListening() const
Indicate is currently listening and processing requests.
Definition: http.h:1357
virtual PHTTPServer * CreateServerForHTTP()
virtual PBoolean Parse(const PString &auth, PBoolean proxy)
virtual PBoolean ProcessCommand()
Process commands, dispatching to the appropriate virtual function.
PBoolean IsCompatible(int major, int minor) const
void AllowDirectories(PBoolean enable=true)
Enable or disable directory listings when a default directory file does not exist.
void ResetMultipartFormInfo()
Definition: http.h:986
PHTTP()
Create a TCP/IP HTTP protocol channel.
bool PBoolean
Definition: object.h:174
bool m_persist
Definition: http.h:768
static const PCaselessString & ChunkedTag()
virtual PString GetEntityBody()
Definition: http.h:304
Could not write transport.
Definition: http.h:181
PURL m_baseURL
Base URL for the resource, may accept URLS with a longer hierarchy.
Definition: http.h:1990
void SetDefaultMIMEInfo(PMIMEInfo &info, const PHTTPConnectionInfo &connectInfo) const
Set the default mime info.
PString cnonce
Definition: http.h:437
const PString & GetLocalRealm() const
Get the realm or name space for the user authorisation name and password as required by the basic aut...
Definition: http.h:1568
bool m_allowDirectoryListing
Definition: http.h:2381
static const PCaselessString & WebSocketAcceptTag()
virtual PINDEX ParseResponse(const PString &line)
Parse a response line string into a response code and any extra info on the line. ...
virtual bool OnCommand(PINDEX cmd, const PURL &url, const PString &args, PHTTPConnectionInfo &connectInfo)
Called when a request is received.
virtual ~AuthObject()
Definition: http.h:301
PIPSocket::Address origin
IP address of origin host for request.
Definition: http.h:1438
PReadWriteMutex * mutex
Definition: http.h:130
void SetPersistenceTimeout(const PTimeInterval &t)
Set the maximum time a persistent connection may persist.
Definition: http.h:971
virtual PBoolean Validate(const PHTTPRequest &request, const PString &authInfo) const =0
Validate the user and password provided by the remote HTTP client for the realm specified by the clas...
void ClearAuthority()
Set the current authority for the resource to unrestricted.
305 - proxy redirect
Definition: http.h:197
PHTTPSpace m_urlSpace
Definition: http.h:1305
PString opaque
Definition: http.h:432
PString m_method
Definition: http.h:363
The character string class.
Definition: pstring.h:108
void SetWebSocketNotifier(const PString &protocol, const WebSocketNotifier ¬ifier)
Set the handler for WebSocket sub-protocol.
static const PCaselessString & PragmaTag()
A socket that uses the TCP transport on the Internet Protocol.
Definition: tcpsock.h:40
409 - resource conflict on action
Definition: http.h:207
static const PCaselessString & LastModifiedTag()
virtual bool OnGET(const PHTTPConnectionInfo &conInfo)
Handle a GET command from a client.
PString m_realm
Definition: http.h:1586
WORD localPort
Port number of local server for request.
Definition: http.h:1440
bool m_reader
Definition: http.h:291
300 - requested resource available elsewehere
Definition: http.h:192
#define PCONTAINERINFO(cls, par)
Macro to declare funtions required in a container.
Definition: contain.h:340
411 - no Content-Length
Definition: http.h:209
bool ConnectURL(const PURL &url)
Connect at transport level to remote, based on URL.
virtual PString GetAuthRealm() const
Definition: http.h:416
PHTTPResource(const PURL &url)
bool IsWebSocket() const
Definition: http.h:991
304 - document has not been modified
Definition: http.h:196
PString m_fakeIndex
Definition: http.h:2397
Content Processer returned error.
Definition: http.h:178
PString nonce
Definition: http.h:430
atomic< uint32_t > nonceCount
Definition: http.h:438
virtual PBoolean Write(const void *buf, PINDEX len)
Low level write to the channel.
PBoolean FindAuthorisations(const PDirectory &dir, PString &realm, PStringToString &authorisations)
PHTTP::StatusCode code
Status code for OnError() reply.
Definition: http.h:1434
virtual PString LoadText(PHTTPRequest &request)
Get a block of text data (eg HTML) that the resource contains.
This class defines a thread of execution in the system.
Definition: thread.h:66
Abstract class to embody the base functionality of a container.
Definition: contain.h:99
virtual PBoolean IsModifiedSince(const PTime &when)
Check to see if the resource has been modified since the date specified.
This class describes the simple authorisation mechanism for a Universal Resource Locator, a fixed realm, multiple usernames and passwords.
Definition: http.h:1598
bool isPersistent
Definition: http.h:1002
static const PCaselessString & ContentTypeTag()
Definition: http.h:224
AddOptions
Definition: http.h:65
This class describes a name space that a Universal Resource Locator operates in.
Definition: http.h:56
virtual PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
void SetPersistent(bool persist=true)
Set persistent connection mode.
Definition: http.h:747
PHTTPTailFile(const PString &filename)
Contruct a new simple file resource for the HTTP space.
bool IsPersistent() const
Definition: http.h:953
This class describes a HyperText markup Language string as used by the World Wide Web and the PURL an...
Definition: html.h:45
static const PString & Empty()
Return an empty string.
PString m_listenerInterfaces
Definition: http.h:1400
PMIMEInfo mimeInfo
Definition: http.h:1001
Listener for incoming HTTP request with thread pool to handle those requests.
Definition: http.h:1327
virtual PBoolean OnPOSTData(PHTTPRequest &request, const PStringToString &data)
Send the data associated with a POST command.
PTime m_arrivalTime
Time of arrival of the HTTP request.
Definition: http.h:1442
PHTTPSpace()
Constructor for HTTP URL Name Space.
Class for a factory to create concrete class instances without parameters during construction.
Definition: pfactory.h:396
ThreadPool m_threadPool
Definition: http.h:1406
PHTTPListener & m_listener
Definition: http.h:1381
A class describing an IP address.
Definition: ipsock.h:59
PStringToString m_users
Definition: http.h:1670
PFactory< PHTTPClientAuthentication > PHTTPClientAuthenticationFactory
Definition: http.h:347
bool GetBinaryDocument(const PURL &url, PBYTEArray &document, const PString &contentType=PString::Empty())
Get the document specified by the URL.
PMultiPartList m_multipartFormInfo
Definition: http.h:1012
WORD GetPort() const
Get the port we are lkstening on.
Definition: http.h:1360
virtual PHTTPRequest * CreateRequest(const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPServer &socket)
Create a new request block for this type of resource.
bool qopAuthInt
Definition: http.h:435
static const PCaselessString & KeepAliveTag()
void EndWrite()
This function attempts to release the mutex for writing.
Definition: syncthrd.h:313
bool SendResponse(StatusCode code, const PString &body=PString::Empty())
Send a response to client.
int GetMinorVersion() const
Definition: http.h:957
Could not read transport.
Definition: http.h:182
bool GetTextDocument(const PURL &url, PString &document, const PString &contentType=PString::Empty())
Get the document specified by the URL.
PString GetHotLink() const
Get relative hot link for this resouce.
Definition: http.h:1719
virtual PBoolean IsActive() const
Determine if the authirisation is to be applied.
virtual PBoolean Read(void *buf, PINDEX len)
Low level read from the channel.
PHTTPServer & server
Server channel that request initiated on.
Definition: http.h:1430
virtual PBoolean OnError(StatusCode code, const PCaselessString &extra, const PHTTPConnectionInfo &connectInfo)
Write an error response for the specified code.
DWORD GetHitCount() const
Get the current hit count for the resource.
Definition: http.h:1752
403 - request is refused due to unsufficient authorisation
Definition: http.h:201
virtual PHTTPRequest * CreateRequest(const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPServer &socket)
Create a new request block for this type of resource.
const PString & GetUserName() const
Get the user name allocated to this simple authorisation.
Definition: http.h:1575
unsigned m_maxRedirects
Definition: http.h:769
StatusCode
Definition: http.h:176
PString m_string
Definition: http.h:2086
long GetSeconds() const
Get the number of whole seconds for the time interval.
virtual PBoolean OnGETData(PHTTPServer &server, const PURL &url, const PHTTPConnectionInfo &connectInfo, PHTTPRequest &request)
Send the data associated with a GET command.
static const PCaselessString & ConnectionTag()
bool ReadContentBody(PMIMEInfo &replyMIME, ContentProcessor &processor)
Read the body of the HTTP command.
PNotifierTemplate< PHTTPConnectionInfo > WebSocketNotifier
Definition: http.h:1271
PString m_userName
Definition: http.h:770
static const PCaselessString & ProxyAuthenticateTag()
408 - server timeout on request
Definition: http.h:206
static const PCaselessString & UpgradeTag()
406 - encoding not acceptable
Definition: http.h:204
virtual PBoolean LoadData(PHTTPRequest &request, PCharArray &data)
Get a block of data that the resource contains.
PHTTPRequest(const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPResource *resource, PHTTPServer &server)
PSocketList m_httpListeningSockets
Definition: http.h:1403
PQueuedThreadPool< Worker > ThreadPool
Definition: http.h:1386
This class defines a thread synchronisation object.
Definition: syncthrd.h:256
virtual PBoolean LoadData(PHTTPRequest &request, PCharArray &data)
Get a block of data that the resource contains.
PHTTPSpace & GetSpace()
Definition: http.h:1394
PBoolean DelResource(const PURL &url)
Delete an existing resource to the URL space.
static const PCaselessString & IfModifiedSinceTag()
const PMultiPartList & GetMultipartFormInfo() const
Definition: http.h:983
virtual PBoolean ReadResponse()
Read a response code followed by a text string describing the response to a command.
virtual bool InternalOnCommand(PHTTPServer &server, const PHTTPConnectionInfo &conInfo, PHTTP::Commands cmd)
common code for GET and HEAD commands
202 - request accepted, but not yet completed
Definition: http.h:187
const PURL & GetURL() const
Definition: http.h:946
__inline void EndRead()
This function attempts to release the mutex for reading.
Definition: syncthrd.h:281
bool isProxyConnection
Definition: http.h:1004
static PHTTPClientAuthentication * ParseAuthenticationRequired(bool isProxy, const PMIMEInfo &line, PString &errorMsg)
static const PCaselessString & WebSocketVersionTag()
virtual void SendData(PHTTPRequest &request)
Send the data associated with a command.
virtual PString GetMethod()=0
PURL url
Definition: http.h:1000
bool qopAuth
Definition: http.h:434
502 - error whilst acting as gateway
Definition: http.h:213
unsigned GetPersistenceMaximumTransations() const
Get the maximum number of transations (GET/POST etc) for persistent connection.
Definition: http.h:976
PString GetEntityBody() const
Definition: http.h:989
virtual PBoolean Authorise(AuthObject &pdu) const
virtual PBoolean Authorise(AuthObject &pdu) const =0
static const PCaselessString & DateTag()
virtual PString GetURI()=0
PString authRealm
Definition: http.h:429
407 - must authenticate with proxy first
Definition: http.h:205
virtual void OnLoadedText(PHTTPRequest &request, PString &text)
This is called after the text has been loaded and may be used to customise or otherwise mangle a load...
PString username
Definition: http.h:343
PMIMEInfo outMIME
MIME information used in reply.
Definition: http.h:1435
static const PCaselessString & TextPlain()
PTime m_queuedTime
Definition: http.h:1384
atomic< unsigned > m_hitCount
Count of number of times resource was accessed.
Definition: http.h:1993
A TCP/IP socket for the HyperText Transfer Protocol version 1.0.
Definition: http.h:1042
A common base class for TCP/IP socket for the HyperText Transfer Protocol version 1...
Definition: http.h:160
This object describes a HyperText Transport Protocol request.
Definition: http.h:1417
static const PCaselessString & HostTag()
PString AsString(UrlFormat fmt=FullURL) const
Convert the URL object into its string representation.
P_REMOVE_VIRTUAL(PBoolean, OnGET(PHTTPServer &, const PURL &, const PMIMEInfo &, const PHTTPConnectionInfo &), false)
Reusability
Flags to reuse of port numbers in Listen() function.
Definition: socket.h:85
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
This object describes the connectiono associated with a HyperText Transport Protocol request...
Definition: http.h:937
206 - partial GET succeeded
Definition: http.h:191
Commands
Definition: http.h:166
void ClearWebSocket()
Definition: http.h:992
This class describes a Universal Resource Locator.
Definition: url.h:56
100 - Continue
Definition: http.h:183
static const PCaselessString & AllowTag()
PHTTPContentProcessor ContentProcessor
Call back to process the body of the HTTP command.
Definition: http.h:484
virtual PString GetUsername() const
Definition: http.h:326
int majorVersion
Definition: http.h:1006
virtual PString GetRealm(const PHTTPRequest &request) const =0
Get the realm or name space for the user authorisation name and password as required by the basic aut...
400 - request malformed or not understood
Definition: http.h:198
PList< PHTTPServer > m_httpServers
Definition: http.h:1404
PHTTPResource * m_resource
HTTP resource found for the request.
Definition: http.h:1441
Algorithm GetAlgorithm() const
Definition: http.h:424
virtual bool OnHEAD(const PHTTPConnectionInfo &conInfo)
Handle a HEAD command from a client.
virtual PString LoadText(PHTTPRequest &request)
Get a block of text data (eg HTML) that the resource contains.
PHTTP::Commands GetCommandCode() const
Definition: http.h:943
bool GetStale() const
Definition: http.h:426
Algorithm algorithm
Definition: http.h:431
PHTTPDirectory(const PURL &url, const PDirectory &dir)
virtual PMIMEInfo & GetMIME()
virtual ~PHTTPContentProcessor()
Definition: http.h:286
PString m_authorisationRealm
Definition: http.h:2380
PHTTPClientAuthentication()
virtual PString ReadEntityBody()
Read the entity body associated with a HTTP request, and close the socket if not a persistent connect...
This object describes a HyperText Transport Protocol resource which is a single file.
Definition: http.h:2224
const PTime & GetServiceStartTime() const
Get start of service time.
Definition: http.h:1292
void SetAuthenticationInfo(const PString &userName, const PString &password)
Set authentication paramaters to be use for retreiving documents.
201 - new resource created: entity body contains URL
Definition: http.h:186
const PMIMEInfo & inMIME
Extra MIME information in command.
Definition: http.h:1432
virtual void SetAuthRealm(const PString &)
Definition: http.h:332
virtual PBoolean Validate(const PHTTPRequest &request, const PString &authInfo) const
Validate the user and password provided by the remote HTTP client for the realm specified by the clas...
virtual PString GetMethod()
504 - timeout whilst talking to gateway
Definition: http.h:215