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

📄 http.h

📁 radius协议源码÷The Radius Stack will connect to a Radius Server. This stack implementation is built upo
💻 H
📖 第 1 页 / 共 4 页
字号:
     */    virtual PString GetRealm(      const PHTTPRequest & request   // Request information.    ) const = 0;    /** Validate the user and password provided by the remote HTTP client for       the realm specified by the class instance.       @return       TRUE if the user and password are authorised in the realm.     */    virtual BOOL Validate(      const PHTTPRequest & request,  // Request information.      const PString & authInfo       // Authority information string.    ) const = 0;    /** Determine if the authirisation is to be applied. This could be used to       distinguish between net requiring authorisation and requiring autorisation       but having no password.       The default behaviour is to return TRUE.       @return       TRUE if the authorisation in the realm is to be applied.     */    virtual BOOL IsActive() const;  protected:    static void DecodeBasicAuthority(      const PString & authInfo,   // Authority information string.      PString & username,         // User name decoded from authInfo      PString & password          // Password decoded from authInfo    );};//////////////////////////////////////////////////////////////////////////////// PHTTPSimpleAuth/** This class describes the simplest authorisation mechanism for a Universal   Resource Locator, a fixed realm, username and password. */class PHTTPSimpleAuth : public PHTTPAuthority{  PCLASSINFO(PHTTPSimpleAuth, PHTTPAuthority)  public:    PHTTPSimpleAuth(      const PString & realm,      // Name space for the username and password.      const PString & username,   // Username that this object wiull authorise.      const PString & password    // Password for the above username.    );    // Construct the simple authorisation structure.  // Overrides from class PObject.    /** Create a copy of the class on the heap. This is used by the       #PHTTPResource# classes for maintaining authorisation to       resources.       @return       pointer to new copy of the class instance.     */    virtual PObject * Clone() const;  // Overrides from class PHTTPAuthority.    /** Get the realm or name space for the user authorisation name and       password as required by the basic authorisation system of HTTP/1.0.       @return       String for the authorisation realm name.     */    virtual PString GetRealm(      const PHTTPRequest & request   // Request information.    ) const;    /** Validate the user and password provided by the remote HTTP client for       the realm specified by the class instance.       @return       TRUE if the user and password are authorised in the realm.     */    virtual BOOL Validate(      const PHTTPRequest & request,  // Request information.      const PString & authInfo       // Authority information string.    ) const;    /** Determine if the authirisation is to be applied. This could be used to       distinguish between net requiring authorisation and requiring autorisation       but having no password.       The default behaviour is to return TRUE.       @return       TRUE if the authorisation in the realm is to be applied.     */    virtual BOOL IsActive() const;    /** Get the user name allocated to this simple authorisation.       @return       String for the authorisation user name.     */    const PString & GetUserName() const { return username; }    /** Get the password allocated to this simple authorisation.       @return       String for the authorisation password.     */    const PString & GetPassword() const { return password; }  protected:    PString realm;    PString username;    PString password;};//////////////////////////////////////////////////////////////////////////////// PHTTPMultiSimpAuth/** This class describes the simple authorisation mechanism for a Universal   Resource Locator, a fixed realm, multiple usernames and passwords. */class PHTTPMultiSimpAuth : public PHTTPAuthority{  PCLASSINFO(PHTTPMultiSimpAuth, PHTTPAuthority)  public:    PHTTPMultiSimpAuth(      const PString & realm      // Name space for the username and password.    );    PHTTPMultiSimpAuth(      const PString & realm,             // Name space for the usernames.      const PStringToString & userList // List of usernames and passwords.    );    // Construct the simple authorisation structure.  // Overrides from class PObject.    /** Create a copy of the class on the heap. This is used by the       #PHTTPResource# classes for maintaining authorisation to       resources.       @return       pointer to new copy of the class instance.     */    virtual PObject * Clone() const;  // Overrides from class PHTTPAuthority.    /** Get the realm or name space for the user authorisation name and       password as required by the basic authorisation system of HTTP/1.0.       @return       String for the authorisation realm name.     */    virtual PString GetRealm(      const PHTTPRequest & request   // Request information.    ) const;    /** Validate the user and password provided by the remote HTTP client for       the realm specified by the class instance.       @return       TRUE if the user and password are authorised in the realm.     */    virtual BOOL Validate(      const PHTTPRequest & request,  // Request information.      const PString & authInfo       // Authority information string.    ) const;    /** Determine if the authirisation is to be applied. This could be used to       distinguish between net requiring authorisation and requiring autorisation       but having no password.       The default behaviour is to return TRUE.       @return       TRUE if the authorisation in the realm is to be applied.     */    virtual BOOL IsActive() const;    /** Get the user name allocated to this simple authorisation.       @return       String for the authorisation user name.     */    void AddUser(      const PString & username,   // Username that this object wiull authorise.      const PString & password    // Password for the above username.    );  protected:    PString realm;    PStringToString users;};//////////////////////////////////////////////////////////////////////////////// PHTTPResource/** This object describes a HyperText Transport Protocol resource. A tree of   these resources are available to the #PHTTPSocket# class. */class PHTTPResource : public PObject{  PCLASSINFO(PHTTPResource, PObject)  protected:    PHTTPResource(      const PURL & url               // Name of the resource in URL space.    );    PHTTPResource(      const PURL & url,              // Name of the resource in URL space.      const PHTTPAuthority & auth    // Authorisation for the resource.    );    PHTTPResource(      const PURL & url,              // Name of the resource in URL space.      const PString & contentType    // MIME content type for the resource.    );    PHTTPResource(      const PURL & url,              // Name of the resource in URL space.      const PString & contentType,   // MIME content type for the resource.      const PHTTPAuthority & auth    // Authorisation for the resource.    );    // Create a new HTTP Resource.  public:    virtual ~PHTTPResource();    // Destroy the HTTP Resource.  // New functions for class.    /** Get the URL for this resource.       @return       The URL for this resource.     */    const PURL & GetURL() const { return baseURL; }    /** Get the current content type for the resource.       @return       string for the current MIME content type.     */    const PString & GetContentType() const { return contentType; }    /** Set the current content type for the resource.     */    void SetContentType(      const PString & newType    ) { contentType = newType; }    /** Get the current authority for the resource.       @return       Pointer to authority or NULL if unrestricted.     */    PHTTPAuthority * GetAuthority() const { return authority; }    /** Set the current authority for the resource.     */    void SetAuthority(      const PHTTPAuthority & auth    );    /** Set the current authority for the resource to unrestricted.     */    void ClearAuthority();    /** Get the current hit count for the resource. This is the total number of       times the resource was asked for by a remote client.       @return       Hit count for the resource.     */    DWORD GetHitCount() const { return hitCount; }    void ClearHitCount() { hitCount = 0; }    // Clear the hit count for the resource.    /** Handle the GET command passed from the HTTP socket.       The default action is to check the authorisation for the resource and       call the virtuals #LoadHeaders()# and #OnGETData()# to get       a resource to be sent to the socket.       @return       TRUE if the connection may persist, FALSE if the connection must close.       If there is no ContentLength field in the response, this value must       be FALSE for correct operation.     */    virtual BOOL OnGET(      PHTTPServer & server,       // HTTP server that received the request      const PURL & url,           // Universal Resource Locator for document.      const PMIMEInfo & info,     // Extra MIME information in command.      const PHTTPConnectionInfo & conInfo    );    /** Load the data associated with a GET command.       The default action is to call the virtual #LoadData()# to get a       resource to be sent to the socket.       @return       TRUE if the connection may persist, FALSE if the connection must close.       If there is no ContentLength field in the response, this value must       be FALSE for correct operation.    */    virtual BOOL OnGETData(      PHTTPServer & server,      const PURL & url,      const PHTTPConnectionInfo & connectInfo,      PHTTPRequest & request    );    /** Handle the HEAD command passed from the HTTP socket.       The default action is to check the authorisation for the resource and       call the virtual #LoadHeaders()# to get the header information to       be sent to the socket.       @return       TRUE if the connection may persist, FALSE if the connection must close       If there is no ContentLength field in the response, this value must       be FALSE for correct operation.     */    virtual BOOL OnHEAD(      PHTTPServer & server,       // HTTP server that received the request      const PURL & url,           // Universal Resource Locator for document.      const PMIMEInfo & info,     // Extra MIME information in command.      const PHTTPConnectionInfo & conInfo    );    /** Handle the POST command passed from the HTTP socket.       The default action is to check the authorisation for the resource and       call the virtual #Post()# function to handle the data being       received.       @return       TRUE if the connection may persist, FALSE if the connection must close       If there is no ContentLength field in the response, this value must       be FALSE for correct operation.     */    virtual BOOL OnPOST(      PHTTPServer & server,         // HTTP server that received the request      const PURL & url,             // Universal Resource Locator for document.      const PMIMEInfo & info,       // Extra MIME information in command.      const PStringToString & data, // Variables in the POST data.      const PHTTPConnectionInfo & conInfo    );    /** Check to see if the resource has been modified since the date       specified.       @return       TRUE if has been modified since.     */    virtual BOOL IsModifiedSince(      const PTime & when    // Time to see if modified later than    );    /** Get a block of data (eg HTML) that the resource contains.       @return       Status of load operation.     */    virtual BOOL GetExpirationDate(      PTime & when          // Time that the resource expires    );    /** Create a new request block for this type of resource.       The default behaviour is to create a new PHTTPRequest instance.       @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.	  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.    ) = 0;    /** Get a block of data that the resource contains.       The default behaviour is to call the #LoadText()# function and       if successful, call the #OnLoadedText()# function.

⌨️ 快捷键说明

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