ok2c commented on code in PR #689:
URL: 
https://github.com/apache/httpcomponents-core/pull/689#discussion_r3805362578


##########
httpcore5/src/main/java/org/apache/hc/core5/http/support/ProxyStatusSupport.java:
##########
@@ -0,0 +1,383 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http.support;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ParseException;
+import org.apache.hc.core5.http.ProxyStatus;
+import org.apache.hc.core5.http.message.ParserCursor;
+import org.apache.hc.core5.util.Args;
+
+/**
+ * Parser for the {@code Proxy-Status} response field defined by RFC 9209. The 
field is a
+ * Structured Fields (RFC 8941) List whose members are Items: an intermediary 
identity followed
+ * by parameters.
+ * <p>
+ * Parsing is strict. Input that does not conform to the grammar is rejected 
with a
+ * {@link ParseException}, since RFC 8941 requires a field that fails to parse 
to be treated as
+ * absent rather than partially applied. The parser only decodes the field; it 
does not interpret
+ * or act on the reported values. Parameter values are returned by their 
structured-field types:
+ * {@link String} for tokens and strings, {@link Long} for integers, {@link 
BigDecimal} for
+ * decimals, {@link Boolean} for booleans and {@code byte[]} for byte 
sequences.
+ *
+ * @since 5.5
+ */
+@Contract(threading = ThreadingBehavior.STATELESS)
+public final class ProxyStatusSupport {
+
+    private ProxyStatusSupport() {
+        // no instances
+    }
+
+    /**
+     * Parses a {@code Proxy-Status} field value into its ordered list of 
members.
+     *
+     * @param value the field value; must not be {@code null}.
+     * @return the parsed members, empty when the value contains no members.
+     * @throws ParseException if the value does not conform to RFC 9209 / RFC 
8941.
+     */
+    public static List<ProxyStatus> parse(final CharSequence value) throws 
ParseException {
+        Args.notNull(value, "Proxy-Status value");
+        final ParserCursor cursor = new ParserCursor(0, value.length());

Review Comment:
   @arturobernalg Keep it flexible and pass `ParserCursor` as a parameter. That 
would enable the parse message to take its input from directly 
`FormattedHeader` without having to make an intermediate String out of it. 
   
   See `MessageSupport#parserHeaderValue`



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to