version 1.44, 2008/12/02 09:00:19
|
version 1.45, 2008/12/18 18:52:00
|
|
|
/** | /** |
Constant representing the authentication challenge header. | Constant representing the authentication challenge header. |
*/ | */ |
static const String WWW_AUTHENTICATE = "WWW-Authenticate"; |
static const char* WWW_AUTHENTICATE = "WWW-Authenticate"; |
| |
/** | /** |
Constant representing the Basic authentication header. | Constant representing the Basic authentication header. |
|
|
// | // |
// Search for "WWW-Authenticate" header: | // Search for "WWW-Authenticate" header: |
// | // |
String authHeader; |
const char* authHeader; |
String authType; | String authType; |
String authRealm; | String authRealm; |
| |
|
|
} | } |
| |
Boolean ClientAuthenticator::_parseAuthHeader( | Boolean ClientAuthenticator::_parseAuthHeader( |
const String authHeader, |
const char* authHeader, |
String& authType, | String& authType, |
String& authRealm) | String& authRealm) |
{ | { |
CString header = authHeader.getCString(); |
|
const char* pAuthHeader = header; |
|
|
|
// | // |
// Skip the white spaces in the begining of the header | // Skip the white spaces in the begining of the header |
// | // |
while (*pAuthHeader && isspace(*pAuthHeader)) |
while (*authHeader && isspace(*authHeader)) |
{ | { |
*pAuthHeader++; |
*authHeader++; |
} | } |
| |
// | // |
// Get the authentication type | // Get the authentication type |
// | // |
String type = _getSubStringUptoMarker(&pAuthHeader, CHAR_BLANK); |
String type = _getSubStringUptoMarker(&authHeader, CHAR_BLANK); |
| |
if (!type.size()) | if (!type.size()) |
{ | { |
|
|
// | // |
// Ignore the start quote | // Ignore the start quote |
// | // |
_getSubStringUptoMarker(&pAuthHeader, CHAR_QUOTE); |
_getSubStringUptoMarker(&authHeader, CHAR_QUOTE); |
| |
| |
// | // |
// Get the realm ending with a quote | // Get the realm ending with a quote |
// | // |
String realm = _getSubStringUptoMarker(&pAuthHeader, CHAR_QUOTE); |
String realm = _getSubStringUptoMarker(&authHeader, CHAR_QUOTE); |
| |
if (!realm.size()) | if (!realm.size()) |
{ | { |