jira-importer opened a new issue, #1108:
URL: https://github.com/apache/httpcomponents-core/issues/1108

   **[Roy 
Hashimoto](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rhashimoto)**
 opened 
**[HTTPCORE-606](https://issues.apache.org/jira/browse/HTTPCORE-606?redirect=false)**
 and commented
   
   The attached file implements a simple H2/TLS server that returns a roughly 
64 KB response. Things work fine when HTTP1 is used but with HTTP2 a framing 
layer error is reported.
   
   Using curl:
   
   `$ curl -k https://localhost:8080/`
   `curl: (16) Error in the HTTP2 framing layer`
   
   Using Chrome:
   
   `GET https://localhost:8080/ net::ERR_HTTP2_FRAME_SIZE_ERROR 200`
   
   I'm using Conscrypt (org.conscrypt:conscrypt-openjdk-uber:2.2.1) because I 
currently have only Java 8 environments so that's how I enable H2. I don't know 
if the bug is related to the JSSE implementation or not. I did try to disable 
TLS on the server and connect with `curl --http2` but that didn't work - curl 
offered to upgrade but the server returned HTTP1 and the error doesn't happen 
with HTTP1.
   
   The response is big enough that writing the response body data to the 
DataStreamChannel does not consume it all in one call. I believe this might be 
a factor because if I instead dribble the data out with small writes over time 
like this then no error occurs:
   
   `private int counter = 0;`
   `@Override`
   `public void produce(DataStreamChannel channel) throws IOException {`
   `  if (counter < 4096) {`
   `    ByteBuffer buffer = ByteBuffer.wrap(String.format("%4d:0123456789\n", 
counter).getBytes());`
   `    counter++;`
   `    channel.write(buffer);`
   `    new Thread(() -> {`
   `      try {`
   `        Thread.sleep(50);`
   `      } catch (InterruptedException ignored) {`
   `      `}
   `      channel.requestOutput();`
   `    }).start();`
   `  } else {`
   `    channel.endStream();`
   `  `}
   `}`
   
   To run the test program you will need to modify the code at the beginning of 
`main` to load your own X509 KeyStore. Connect to the server with an H2-capable 
client on port 8080.
   
   
   ---
   
   **Affects:** 5.0-beta9
   
   **Attachments:**
   - 
[ConscryptTest.java](https://issues.apache.org/jira/secure/attachment/12982983/ConscryptTest.java)
 (_8.25 kB_)
   


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