Skip to content

Commit

Permalink
Implement #8057 103 Early Hint
Browse files Browse the repository at this point in the history
Fixed flake. @sbordet please review this commit!
  • Loading branch information
gregw committed May 30, 2022
1 parent 9451723 commit 01bf0f4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Expand Up @@ -187,9 +187,12 @@ private void process()
}
else if (read == 0)
{
releaseNetworkBuffer();
fillInterested();
return;
if (networkBuffer.isEmpty())
{
releaseNetworkBuffer();
fillInterested();
return;
}
}
else
{
Expand Down Expand Up @@ -245,19 +248,22 @@ private boolean parse()
this.method = null;
if (getHttpChannel().isTunnel(method, status))
return true;
}

if (networkBuffer.isEmpty())
return false;
if (networkBuffer.isEmpty())
return false;

if (complete)
{
// TODO this can clean a pipelined response after a 1xx
if (LOG.isDebugEnabled())
LOG.debug("Discarding unexpected content after response: {}", networkBuffer);
networkBuffer.clear();
if (!HttpStatus.isInformational(status))
{
if (LOG.isDebugEnabled())
LOG.debug("Discarding unexpected content after response {}: {}", status, networkBuffer);
LOG.info("Discarding unexpected content after response {}: {}", status, networkBuffer);
networkBuffer.clear();
}
return false;
}

if (networkBuffer.isEmpty())
return false;
}
}

Expand Down
Expand Up @@ -222,10 +222,10 @@ public void onComplete(Result result)
};
scenario.client.newRequest(scenario.newURI())
.method("GET")
.timeout(10, TimeUnit.SECONDS)
.timeout(5, TimeUnit.SECONDS)
.send(listener);

assertTrue(complete.await(10, TimeUnit.SECONDS));
assertTrue(complete.await(5, TimeUnit.SECONDS));
assertThat(response.get().getStatus(), is(200));
assertThat(listener.getContentAsString(), is("OK"));
assertThat(hints, contains("one", "two", "three"));
Expand Down

0 comments on commit 01bf0f4

Please sign in to comment.