if ( scheme.equalsIgnoreCase("basic") ) {
// Basic Auth nasty hack
if ( HttpParser.nextItem(raw, ps) < 0 )
error("Invalid basic auth credentials, no basic-cookie.");
if ( unqparams == null ) {
unqparams = new ArrayDictionary(5, 5);
}
unqparams.put("cookie", ps.toString(raw));
} else {
// Normal credentials parsing
ParseState it = new ParseState();
it.separator = (byte) '=';
ps.separator = (byte) ',';
while (HttpParser.nextItem(raw, ps) >= 0 ) {
// Get the param name:
it.prepare(ps);
if (HttpParser.nextItem(raw, it) < 0)
error("Invalid credentials: bad param name.");
String key = it.toString(raw, true);
// Get the param value:
it.prepare();
if ( HttpParser.nextItem(raw, it) < 0)
error("Invalid credentials: no param value.");
it.ioff = it.start;
int offset = HttpParser.skipSpaces(raw, it);
if ((offset < raw.length) && (raw[offset] == '\"')) {
HttpParser.unquote(raw, it);
if ( params == null ) {
params = new ArrayDictionary(5, 5);
}
params.put(key, it.toString(raw));
} else {
if ( unqparams == null ) {
unqparams = new ArrayDictionary(5, 5);
}
unqparams.put(key, it.toString(raw));
}
ps.prepare();
}