RFR: 8310645: CancelledResponse.java does not use HTTP/2 when testing the HttpClient
Conor Cleary
ccleary at openjdk.org
Mon Jul 3 10:38:54 UTC 2023
On Mon, 3 Jul 2023 09:40:48 GMT, Conor Cleary <ccleary at openjdk.org> wrote:
>> So for HTTP/2, the `cancelImpl()` method in `Stream` looks like this.
>>
>>
>> @Override
>> void cancel() {
>> if ((streamid == 0)) {
>> cancel(new IOException("Stream cancelled before streamid assigned"));
>> } else {
>> cancel(new IOException("Stream " + streamid + " cancelled"));
>> }
>> }
>>
>>
>> When the new IOException is passed to cancel, it sets the `errorRef` field to the IOException which then gets returned to us as the cause of the CompletableFuture's cause for cancelling. I think this behaviour is acceptable as the IOException returned will say "Stream x cancelled" which is accurate. Possible that I dont need to have this "CancelException" here
>>
>> May be more difficult to verify the cause of cancellation beyond that which I'll think about.
>
> There is a check that the cancelling BodyHandler sets the cancelled field which may be sufficient
Could also just check that the returned a call to `getMessage()` returns a string that contains cancelled but its not a very nice solution
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14625#discussion_r1250671729
More information about the net-dev
mailing list