Skip to content

Commit

Permalink
Issue #4954 - ByteCount API
Browse files Browse the repository at this point in the history
+ More updates from quick review of concept with simone

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Jun 9, 2020
1 parent dd3813a commit da18068
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Expand Up @@ -31,7 +31,8 @@ public interface ByteCountEvent
Throwable getResponseFailure();

// TODO: do we care about upgraded connections?
// TODO: what about HTTP/2 ?
// TODO: what about the TLS bytes? (SSLConnection bytesIn / bytesOut?)
// TODO: what about HTTP/2 ? (what about non-stream frames? settings, window-updates, reset, etc)

interface HttpByteCount
{
Expand Down
Expand Up @@ -117,6 +117,11 @@ void onBodyEnd(long connectionCount, long byteCountAPI)
this.trailerStart = connectionCount;
}

public void onTrailerStart(long connectionCount)
{
this.trailerStart = connectionCount;
}

void onTrailerEnd(long connectionCount)
{
this.trailerEnd = connectionCount;
Expand Down
Expand Up @@ -60,6 +60,7 @@ public void onRequestEnd(Request request)
HttpInput httpInput = request.getHttpInput();
long byteCountRequestAPI = httpInput.getContentConsumed();
byteCountEventAdaptor.getRequestCount().onBodyEnd(connection.getBytesIn(), byteCountRequestAPI);
byteCountEventAdaptor.getRequestCount().onTrailerStart(connection.getBytesIn());
}
}

Expand All @@ -85,6 +86,8 @@ public void onRequestFailure(Request request, Throwable failure)
}
}

// TODO: investigate Http Dispatch Failure too.

@Override
public void onResponseBegin(Request request)
{
Expand Down
Expand Up @@ -1150,6 +1150,8 @@ default void onResponseContent(Request request, ByteBuffer content)
{
}

// TODO: need onResponseTrailers(Request request) - see https://github.com/eclipse/jetty.project/issues/4956

/**
* Invoked when the response has been fully written.
*
Expand Down

0 comments on commit da18068

Please sign in to comment.