⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http.h

📁 pwlib源码库
💻 H
📖 第 1 页 / 共 5 页
字号:
    PHTTPString(      const PURL & url,            // Name of the resource in URL space.      const PString & str,         // String to return in this resource.      const PString & contentType  // MIME content type for the file.    );    PHTTPString(      const PURL & url,            // Name of the resource in URL space.      const PString & str,         // String to return in this resource.      const PHTTPAuthority & auth  // Authorisation for the resource.    );    PHTTPString(      const PURL & url,            // Name of the resource in URL space.      const PString & str,         // String to return in this resource.      const PString & contentType, // MIME content type for the file.      const PHTTPAuthority & auth  // Authorisation for the resource.    );  // Overrides from class PHTTPResource    /** Get the headers for block of data (eg HTML) that the resource contains.       This will fill in all the fields of the <CODE>outMIME</CODE> parameter       required by the resource and return the status for the load.       @return       TRUE if all OK, FALSE if an error occurred.     */    virtual BOOL LoadHeaders(      PHTTPRequest & request    // Information on this request.    );    /** Get a block of text data (eg HTML) that the resource contains.       The default behaviour is to assert, one of #LoadText()# or       #LoadData()# functions must be overridden for correct operation.       @return       String for loaded text.     */    virtual PString LoadText(      PHTTPRequest & request    // Information on this request.    );  // New functions for class.    /** Get the string for this resource.       @return       String for resource.     */    const PString & GetString() { return string; }    /** Set the string to be returned by this resource.     */    void SetString(      const PString & str   // New string for the resource.    ) { string = str; }  protected:    PString string;};//////////////////////////////////////////////////////////////////////////////// PHTTPFile/** This object describes a HyperText Transport Protocol resource which is a   single file. The file can be anywhere in the file system and is mapped to   the specified URL location in the HTTP name space defined by the   #PHTTPSpace# class. */class PHTTPFile : public PHTTPResource{  PCLASSINFO(PHTTPFile, PHTTPResource)  public:    /** Contruct a new simple file resource for the HTTP space. If no MIME       content type is specified then a default type is used depending on the       file type. For example, "text/html" is used of the file type is       ".html" or ".htm". The default for an unknown type is       "application/octet-stream".     */    PHTTPFile(      const PString & filename     // file in file system and URL name.    );    PHTTPFile(      const PString & filename,    // file in file system and URL name.      const PHTTPAuthority & auth  // Authorisation for the resource.    );    PHTTPFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file       // Location of file in file system.    );    PHTTPFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file,      // Location of file in file system.      const PString & contentType  // MIME content type for the file.    );    PHTTPFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file,      // Location of file in file system.      const PHTTPAuthority & auth  // Authorisation for the resource.    );    PHTTPFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file,      // Location of file in file system.      const PString & contentType, // MIME content type for the file.      const PHTTPAuthority & auth  // Authorisation for the resource.    );  // Overrides from class PHTTPResource    /** Create a new request block for this type of resource.       @return       Pointer to instance of PHTTPRequest descendant class.     */    virtual PHTTPRequest * CreateRequest(      const PURL & url,                  // Universal Resource Locator for document.      const PMIMEInfo & inMIME,          // Extra MIME information in command.      const PMultipartFormInfoArray & multipartFormInfo,  	  PHTTPServer & socket    );    /** Get the headers for block of data (eg HTML) that the resource contains.       This will fill in all the fields of the <CODE>outMIME</CODE> parameter       required by the resource and return the status for the load.       @return       TRUE if all OK, FALSE if an error occurred.     */    virtual BOOL LoadHeaders(      PHTTPRequest & request    // Information on this request.    );    /** Get a block of data that the resource contains.       @return       TRUE if more to load.     */    virtual BOOL LoadData(      PHTTPRequest & request,    // Information on this request.      PCharArray & data          // Data used in reply.    );    /** Get a block of text data (eg HTML) that the resource contains.       The default behaviour is to assert, one of #LoadText()# or       #LoadData()# functions must be overridden for correct operation.       @return       String for loaded text.     */    virtual PString LoadText(      PHTTPRequest & request    // Information on this request.    );  protected:    PHTTPFile(      const PURL & url,       // Name of the resource in URL space.      int dummy    );    // Constructor used by PHTTPDirectory    PFilePath filePath;};class PHTTPFileRequest : public PHTTPRequest{  PCLASSINFO(PHTTPFileRequest, PHTTPRequest)  public:    PHTTPFileRequest(      const PURL & url,             // Universal Resource Locator for document.      const PMIMEInfo & inMIME,     // Extra MIME information in command.      const PMultipartFormInfoArray & multipartFormInfo,      PHTTPServer & server    );    PFile file;};//////////////////////////////////////////////////////////////////////////////// PHTTPTailFile/** This object describes a HyperText Transport Protocol resource which is a   single file. The file can be anywhere in the file system and is mapped to   the specified URL location in the HTTP name space defined by the   #PHTTPSpace# class.   The difference between this and PHTTPFile is that it continually outputs   the contents of the file, as per the unix "tail -f" command. */class PHTTPTailFile : public PHTTPFile{  PCLASSINFO(PHTTPTailFile, PHTTPFile)  public:    /** Contruct a new simple file resource for the HTTP space. If no MIME       content type is specified then a default type is used depending on the       file type. For example, "text/html" is used of the file type is       ".html" or ".htm". The default for an unknown type is       "application/octet-stream".     */    PHTTPTailFile(      const PString & filename     // file in file system and URL name.    );    PHTTPTailFile(      const PString & filename,    // file in file system and URL name.      const PHTTPAuthority & auth  // Authorisation for the resource.    );    PHTTPTailFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file       // Location of file in file system.    );    PHTTPTailFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file,      // Location of file in file system.      const PString & contentType  // MIME content type for the file.    );    PHTTPTailFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file,      // Location of file in file system.      const PHTTPAuthority & auth  // Authorisation for the resource.    );    PHTTPTailFile(      const PURL & url,            // Name of the resource in URL space.      const PFilePath & file,      // Location of file in file system.      const PString & contentType, // MIME content type for the file.      const PHTTPAuthority & auth  // Authorisation for the resource.    );  // Overrides from class PHTTPResource    /** Get the headers for block of data (eg HTML) that the resource contains.       This will fill in all the fields of the <CODE>outMIME</CODE> parameter       required by the resource and return the status for the load.       @return       TRUE if all OK, FALSE if an error occurred.     */    virtual BOOL LoadHeaders(      PHTTPRequest & request    // Information on this request.    );    /** Get a block of data that the resource contains.       @return       TRUE if more to load.     */    virtual BOOL LoadData(      PHTTPRequest & request,    // Information on this request.      PCharArray & data          // Data used in reply.    );};//////////////////////////////////////////////////////////////////////////////// PHTTPDirectory/** This object describes a HyperText Transport Protocol resource which is a   set of files in a directory. The directory can be anywhere in the file   system and is mapped to the specified URL location in the HTTP name space   defined by the #PHTTPSpace# class.   All subdirectories and files are available as URL names in the HTTP name   space. This effectively grafts a file system directory tree onto the URL   name space tree.   See the #PMIMEInfo# class for more information on the mappings between   file types and MIME types. */class PHTTPDirectory : public PHTTPFile{  PCLASSINFO(PHTTPDirectory, PHTTPFile)  public:    PHTTPDirectory(      const PURL & url,            /// Name of the resource in URL space.      const PDirectory & dir       /// Location of file in file system.    );    PHTTPDirectory(      const PURL & url,            /// Name of the resource in URL space.      const PDirectory & dir,      /// Location of file in file system.      const PHTTPAuthority & auth  /// Authorisation for the resource.    );    // Construct a new directory resource for HTTP.  // Overrides from class PHTTPResource    /** Create a new request block for this type of resource.       @return       Pointer to instance of PHTTPRequest descendant class.     */    virtual PHTTPRequest * CreateRequest(      const PURL & url,                  // Universal Resource Locator for document.      const PMIMEInfo & inMIME,          // Extra MIME information in command.      const PMultipartFormInfoArray & multipartFormInfo,  	  PHTTPServer & socket    );    /** Get the headers for block of data (eg HTML) that the resource contains.       This will fill in all the fields of the <CODE>outMIME</CODE> parameter       required by the resource and return the status for the load.       @return       TRUE if all OK, FALSE if an error occurred.     */    virtual BOOL LoadHeaders(      PHTTPRequest & request    /// Information on this request.    );    /** Get a block of text data (eg HTML) that the resource contains.       The default behaviour is to assert, one of #LoadText()# or       #LoadData()# functions must be overridden for correct operation.       @return       String for loaded text.     */    virtual PString LoadText(      PHTTPRequest & request    /// Information on this request.    );    /** Enable or disable access control using .access files. A directory tree containing       a _access file will require authorisation to allow access. This file has        contains one or more lines, each containing a username and password seperated        by a ":" character.       The parameter sets the realm used for authorisation requests. An empty realm disables       auhtorisation.     */    void EnableAuthorisation(const PString & realm);    /** Enable or disable directory listings when a default directory file does not exist     */    void AllowDirectories(BOOL enable = TRUE);  protected:    BOOL CheckAuthority(      PHTTPServer & server,               // Server to send response to.      const PHTTPRequest & request,       // Information on this request.      const PHTTPConnectionInfo & conInfo // Information on the connection    );    BOOL FindAuthorisations(const PDirectory & dir, PString & realm, PStringToString & authorisations);    PDirectory basePath;    PString authorisationRealm;    BOOL allowDirectoryListing;};class PHTTPDirRequest : public PHTTPFileRequest{  PCLASSINFO(PHTTPDirRequest, PHTTPFileRequest)  public:    PHTTPDirRequest(      const PURL & url,             // Universal Resource Locator for document.      const PMIMEInfo & inMIME,     // Extra MIME information in command.      const PMultipartFormInfoArray & multipartFormInfo,       PHTTPServer & server    );    PString fakeIndex;    PFilePath realPath;};#endif // P_HTTPSVC#endif// End Of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -