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


##########
httpcore5/src/main/java/org/apache/hc/core5/http/structured/StructuredFieldHeaders.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * ====================================================================
+ * 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.structured;
+
+import java.util.Iterator;
+import java.util.Objects;
+
+import org.apache.hc.core5.http.FormattedHeader;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.MessageHeaders;
+import org.apache.hc.core5.http.ParseException;
+import org.apache.hc.core5.http.message.BufferedHeader;
+import org.apache.hc.core5.util.Args;
+import org.apache.hc.core5.util.CharArrayBuffer;
+import org.apache.hc.core5.util.Tokenizer;
+
+/**
+ * Integration between Structured Field values and HttpComponents message 
headers.
+ *
+ * @since 5.5
+ */
+public final class StructuredFieldHeaders {
+
+    private StructuredFieldHeaders() {
+    }
+
+    /**
+     * Parses one header as an Structured Field Item.
+     *
+     * @param header the header.
+     * @return the parsed Item.
+     * @throws ParseException if the complete field value is invalid.
+     */
+    public static StructuredFieldItem parseItem(final Header header) throws 
ParseException {
+        final HeaderInput input = input(header);
+        return StructuredFieldParser.parseItem(input.value, input.cursor);
+    }
+
+    /**
+     * Combines all matching field lines and parses them as an Structured 
Field Item.
+     *
+     * @param headers the message headers.
+     * @param name the case-insensitive field name.
+     * @return the parsed Item.
+     * @throws ParseException if the complete field value is invalid or absent.
+     */
+    public static StructuredFieldItem parseItem(final MessageHeaders headers, 
final String name)
+            throws ParseException {
+        final HeaderInput input = combine(matching(headers, name));

Review Comment:
   @arturobernalg You did not answer. Can a single item span across multiple 
headers? Sounds conceptually wrong. Does the RFC require anything like that? 



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