ok2c commented on code in PR #447:
URL:
https://github.com/apache/httpcomponents-client/pull/447#discussion_r1193127854
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheControlHeaderParser.java:
##########
@@ -113,28 +113,14 @@ protected CacheControlHeaderParser() {
* <p>
* "s-maxage" (-1).</p>
*
- * @param header the header to parse, cannot be {@code null}
+ * @param headers the header to parse, cannot be {@code null}
* @return a new {@link CacheControl} instance containing the relevant
caching directives parsed from the header
* @throws IllegalArgumentException if the input header is {@code null}
*/
- public final CacheControl parse(final Header header) {
- Args.notNull(header, "Header");
-
- final CharArrayBuffer buffer;
- final Tokenizer.Cursor cursor;
- if (header instanceof FormattedHeader) {
- buffer = ((FormattedHeader) header).getBuffer();
- cursor = new Tokenizer.Cursor(((FormattedHeader)
header).getValuePos(), buffer.length());
- } else {
- final String s = header.getValue();
- if (s == null) {
- return new CacheControl();
- }
- buffer = new CharArrayBuffer(s.length());
- buffer.append(s);
- cursor = new Tokenizer.Cursor(0, buffer.length());
- }
+ public final CacheControl parse(final Header[] headers) {
Review Comment:
@arturobernalg Please use `Iterator<Header>` instead. One can then use
`Iterator<Header> MessageHeaders#headerIterator(String name)` without creating
an intermediate array of `Header`s.
--
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]