From db3d83b38dd61b90466a0721fa9104e742f3fb8b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 4 Oct 2013 20:28:30 +0200 Subject: Added Basic auth support to cHTTPRequest. --- source/HTTPServer/HTTPMessage.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/HTTPServer/HTTPMessage.h') diff --git a/source/HTTPServer/HTTPMessage.h b/source/HTTPServer/HTTPMessage.h index ef8e12ca4..151eb468f 100644 --- a/source/HTTPServer/HTTPMessage.h +++ b/source/HTTPServer/HTTPMessage.h @@ -91,6 +91,15 @@ public: /// Returns true if more data is expected for the request headers bool IsInHeaders(void) const { return m_EnvelopeParser.IsInHeaders(); } + /// Returns true if the request did present auth data that was understood by the parser + bool HasAuth(void) const { return m_HasAuth; } + + /// Returns the username that the request presented. Only valid if HasAuth() is true + const AString & GetAuthUsername(void) const { return m_AuthUsername; } + + /// Returns the password that the request presented. Only valid if HasAuth() is true + const AString & GetAuthPassword(void) const { return m_AuthPassword; } + protected: /// Parser for the envelope data cEnvelopeParser m_EnvelopeParser; @@ -110,6 +119,15 @@ protected: /// Data that the HTTPServer callbacks are allowed to store. void * m_UserData; + /// Set to true if the request contains auth data that was understood by the parser + bool m_HasAuth; + + /// The username used for auth + AString m_AuthUsername; + + /// The password used for auth + AString m_AuthPassword; + /** Parses the incoming data for the first line (RequestLine) Returns the number of bytes consumed, or -1 for an error -- cgit v1.2.3