You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2020/06/29 18:23:10 UTC

[GitHub] [httpcomponents-client] michael-o commented on a change in pull request #230: HTTPCLIENT-2086

michael-o commented on a change in pull request #230:
URL: https://github.com/apache/httpcomponents-client/pull/230#discussion_r447164816



##########
File path: httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthChallengeParser.java
##########
@@ -58,22 +59,26 @@
     // These private static variables must be treated as immutable and never exposed outside this class
     private static final BitSet TERMINATORS = TokenParser.INIT_BITSET(BLANK, EQUAL_CHAR, COMMA_CHAR);
     private static final BitSet DELIMITER = TokenParser.INIT_BITSET(COMMA_CHAR);
+    private static final BitSet SPACE = TokenParser.INIT_BITSET(BLANK);
 
-    NameValuePair parseTokenOrParameter(final CharSequence buffer, final ParserCursor cursor) {
+    static class ChallengeInt {
 
-        tokenParser.skipWhiteSpace(buffer, cursor);
-        final String token = tokenParser.parseToken(buffer, cursor, TERMINATORS);
-        if (!cursor.atEnd()) {
-            if (buffer.charAt(cursor.getPos()) == BLANK) {
-                tokenParser.skipWhiteSpace(buffer, cursor);
-            }
-            if (!cursor.atEnd() && buffer.charAt(cursor.getPos()) == EQUAL_CHAR) {
-                cursor.updatePos(cursor.getPos() + 1);
-                final String value = tokenParser.parseValue(buffer, cursor, DELIMITER);
-                return new BasicNameValuePair(token, value);
-            }
+        final String schemeName;
+        final List<NameValuePair> params;
+
+        ChallengeInt(final String schemeName) {
+            this.schemeName = schemeName;
+            this.params = new ArrayList<>();
         }
-        return new BasicNameValuePair(token, null);
+
+        @Override
+        public String toString() {
+            return "ChallengeInternal{" +

Review comment:
       I think a `String.format()` would improve readability of this code.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org