ffang commented on PR #3660:
URL: https://github.com/apache/cxf/pull/3660#issuecomment-6583586856

   Hi @vp340 ,
   
   Thanks for the analysis and the test, the race is real: after 
`isConnectionAttemptCompleted()` gives up waiting, a small body is written into 
the pipe and the stream is closed, so a late `subscribe()` used to get 
`noBody()` against a non-zero `contentLength()`. Keeping `pin` fixes that, and 
`testSubscribeAfterPublisherClose` fails without the change.
   
   One problem though: when `contentLen == 0` (GET/DELETE), the pipe is never 
connected, and `subscribe()` now returns `ofInputStream(pin)`. HTTP/1.1 doesn't 
subscribe for an empty body, but HTTP/2 does (`Stream.sendBodyImpl`), so HTTP/2 
GETs now fail with `IOException: Pipe not connected`. The existing 
`JettyClientServerHttp2Test.testBookWithHttp2Redirect` in `systests/transports` 
fails with this PR. Could you pass no pin when there is no body?
   
   ```java
   this.publisher = new HttpClientBodyPublisher(this, contentLen != 0 ? () -> 
pin : null);
   ```
   
   With that, the HTTP/2 and h2c Jetty systests pass. It would also be good to 
add an HTTP/2 GET test.
   
   Best Regards
   Freeman


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

Reply via email to