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 2019/12/28 11:20:51 UTC

[GitHub] [httpcomponents-core] ok2c opened a new pull request #174: Development

ok2c opened a new pull request #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174
 
 
   

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


With regards,
Apache Git Services

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


[GitHub] [httpcomponents-core] rschmitt commented on a change in pull request #174: Development

Posted by GitBox <gi...@apache.org>.
rschmitt commented on a change in pull request #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174#discussion_r361813870
 
 

 ##########
 File path: httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
 ##########
 @@ -287,13 +290,25 @@ public Header decodeHeader(final ByteBuffer src) throws HPackException {
     }
 
     public List<Header> decodeHeaders(final ByteBuffer src) throws HPackException {
+        final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE;
+        int listSize = 0;
 
         final List<Header> list = new ArrayList<>();
         while (src.hasRemaining()) {
             final Header header = decodeHeader(src);
             if (header == null) {
                 break;
             }
+            if (enforceSizeLimit) {
+                listSize += header.getName().length() * 2;
+                if (header.getValue() != null) {
+                    listSize += header.getValue().length() * 2;
+                }
+                listSize += 32;
 
 Review comment:
   I am certain that the specification is referring to bytes on the wire, not the internal in-memory representation, which the peer cannot possibly know. Furthermore, due to [JEP 254](https://openjdk.java.net/jeps/254), modern JVMs now use one byte per character to represent most strings.

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


With regards,
Apache Git Services

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


[GitHub] [httpcomponents-core] ok2c merged pull request #174: Development

Posted by GitBox <gi...@apache.org>.
ok2c merged pull request #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174
 
 
   

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


With regards,
Apache Git Services

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


[GitHub] [httpcomponents-core] ok2c commented on a change in pull request #174: Development

Posted by GitBox <gi...@apache.org>.
ok2c commented on a change in pull request #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174#discussion_r361842980
 
 

 ##########
 File path: httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
 ##########
 @@ -287,13 +290,25 @@ public Header decodeHeader(final ByteBuffer src) throws HPackException {
     }
 
     public List<Header> decodeHeaders(final ByteBuffer src) throws HPackException {
+        final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE;
+        int listSize = 0;
 
         final List<Header> list = new ArrayList<>();
         while (src.hasRemaining()) {
             final Header header = decodeHeader(src);
             if (header == null) {
                 break;
             }
+            if (enforceSizeLimit) {
+                listSize += header.getName().length() * 2;
+                if (header.getValue() != null) {
+                    listSize += header.getValue().length() * 2;
+                }
+                listSize += 32;
 
 Review comment:
   @rschmitt Fair enough. Makes sense. Please review 9db8bf158441599de893d4f801dbb9ac71340eec

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


With regards,
Apache Git Services

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


[GitHub] [httpcomponents-core] ok2c commented on issue #174: Development

Posted by GitBox <gi...@apache.org>.
ok2c commented on issue #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174#issuecomment-569408266
 
 
   @rschmitt Would you like to review the change-set adding support for `SETTINGS_MAX_HEADER_LIST_SIZE` H2 parameter?

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


With regards,
Apache Git Services

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


[GitHub] [httpcomponents-core] ok2c commented on a change in pull request #174: Development

Posted by GitBox <gi...@apache.org>.
ok2c commented on a change in pull request #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174#discussion_r361808386
 
 

 ##########
 File path: httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
 ##########
 @@ -287,13 +290,25 @@ public Header decodeHeader(final ByteBuffer src) throws HPackException {
     }
 
     public List<Header> decodeHeaders(final ByteBuffer src) throws HPackException {
+        final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE;
+        int listSize = 0;
 
         final List<Header> list = new ArrayList<>();
         while (src.hasRemaining()) {
             final Header header = decodeHeader(src);
             if (header == null) {
                 break;
             }
+            if (enforceSizeLimit) {
+                listSize += header.getName().length() * 2;
+                if (header.getValue() != null) {
+                    listSize += header.getValue().length() * 2;
+                }
+                listSize += 32;
 
 Review comment:
   @rschmitt How would you interpret the requirement below from section 6.5.2 about length in **octets**? As far as I understand `char` representation in Java takes two octets.
   
   ```The value is based on the
   uncompressed size of header fields, including the length of the
   name and value **in octets** plus an overhead of 32 octets for each
   header field.
   ```

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


With regards,
Apache Git Services

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


[GitHub] [httpcomponents-core] rschmitt commented on a change in pull request #174: Development

Posted by GitBox <gi...@apache.org>.
rschmitt commented on a change in pull request #174: Development
URL: https://github.com/apache/httpcomponents-core/pull/174#discussion_r361807359
 
 

 ##########
 File path: httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
 ##########
 @@ -287,13 +290,25 @@ public Header decodeHeader(final ByteBuffer src) throws HPackException {
     }
 
     public List<Header> decodeHeaders(final ByteBuffer src) throws HPackException {
+        final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE;
+        int listSize = 0;
 
         final List<Header> list = new ArrayList<>();
         while (src.hasRemaining()) {
             final Header header = decodeHeader(src);
             if (header == null) {
                 break;
             }
+            if (enforceSizeLimit) {
+                listSize += header.getName().length() * 2;
+                if (header.getValue() != null) {
+                    listSize += header.getValue().length() * 2;
+                }
+                listSize += 32;
 
 Review comment:
   I don't like how this code duplicates logic and constants from `HPackHeader`. Also, why are you multiplying everything by `2`?

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


With regards,
Apache Git Services

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