Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
arturobernalg committed Nov 3, 2024
1 parent 99a1404 commit 1d91748
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,15 @@ public void process(final HttpResponse response, final EntityDetails entity, fin
if (header != null) {
final String nextNonce;
if (header instanceof FormattedHeader) {
final CharArrayBuffer buf = ((FormattedHeader) header).getBuffer();
final ParserCursor cursor = new ParserCursor(0, buf.length());
cursor.updatePos(((FormattedHeader) header).getValuePos());
final CharSequence buf = ((FormattedHeader) header).getBuffer();
final ParserCursor cursor = new ParserCursor(((FormattedHeader) header).getValuePos(), buf.length());
nextNonce = parseNextNonce(buf, cursor);
} else {
final String headerValue = header.getValue();
final CharSequence headerValue = header.getValue();
final ParserCursor cursor = new ParserCursor(0, headerValue.length());
final CharArrayBuffer buf = new CharArrayBuffer(headerValue.length());
buf.append(headerValue);
nextNonce = parseNextNonce(buf, cursor);
nextNonce = parseNextNonce(headerValue, cursor);
}
if (!TextUtils.isBlank(nextNonce)) {
//context.setAttribute("auth-nextnonce", nextNonce);
HttpClientContext.castOrCreate(context).setNextNonce(nextNonce);
}
}
Expand All @@ -129,7 +125,7 @@ public void process(final HttpResponse response, final EntityDetails entity, fin
* @param cursor the {@link ParserCursor} used to navigate through the buffer content
* @return the extracted {@code nextnonce} parameter value, or {@code null} if the parameter is not found
*/
private String parseNextNonce(final CharArrayBuffer buffer, final ParserCursor cursor) {
private String parseNextNonce(final CharSequence buffer, final ParserCursor cursor) {
while (!cursor.atEnd()) {
final String name = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS);
if ("nextnonce".equals(name)) {
Expand Down

0 comments on commit 1d91748

Please sign in to comment.