Github user ato commented on a diff in the pull request:

    https://github.com/apache/httpcomponents-core/pull/71#discussion_r203638757
  
    --- Diff: 
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientPushHttp2StreamHandler.java
 ---
    @@ -99,16 +101,18 @@ public void consumePromise(final List<Header> headers) 
throws HttpException, IOE
     
                 request = DefaultH2RequestConverter.INSTANCE.convert(headers);
     
    -            final AsyncPushConsumer handler;
    -            try {
    -                handler = pushHandlerFactory != null ? 
pushHandlerFactory.create(request, context) : null;
    -            } catch (final ProtocolException ex) {
    -                throw new H2StreamResetException(H2Error.PROTOCOL_ERROR, 
ex.getMessage());
    -            }
    -            if (handler == null) {
    -                throw new H2StreamResetException(H2Error.REFUSED_STREAM, 
"Stream refused");
    +            if (exchangeHandler == null) {
    +                final AsyncPushConsumer handler;
    +                try {
    +                    handler = pushHandlerFactory != null ? 
pushHandlerFactory.create(request, context) : null;
    +                } catch (final ProtocolException ex) {
    +                    throw new 
H2StreamResetException(H2Error.PROTOCOL_ERROR, ex.getMessage());
    +                }
    +                if (handler == null) {
    +                    throw new 
H2StreamResetException(H2Error.REFUSED_STREAM, "Stream refused");
    --- End diff --
    
    One possible issue is the user cannot refuse a stream if they supply a push 
consumer to execute(). I see now that one of the purposes of the 
PushHandlerFactory is to allow early refusal.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to