Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UNDERTOW-2372] Add request size and response size exchange attribute… #1579

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xjusko
Copy link
Contributor

@xjusko xjusko commented Apr 12, 2024

…s(sizes include headers).
https://issues.redhat.com/browse/UNDERTOW-2372

@baranowb
Copy link
Contributor

This seems like a bit of duplicate of #1536

@baranowb baranowb added duplicate Duplicates other pull request(s) enhancement Enhances existing behaviour or code under verification Currently being verified (running tests, reviewing) before posting a review to contributor new feature/API change New feature to be introduced or a change to the API (non suitable to minor releases) waiting peer review PRs that edit core classes might require an extra review labels Apr 16, 2024
@baranowb baranowb requested review from fl4via and baranowb July 26, 2024 10:19
@baranowb baranowb removed the duplicate Duplicates other pull request(s) label Jul 26, 2024
}
requestSize += calculateRequestLineSize(exchange);
requestSize += exchange.getRequestHeaders().getHeadersBytes();
// add 2 bytes for CRLF, and 2 bytes for ": " between header name and value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive already talked with Marek. This type of code needs detailed exaplanation.

@baranowb
Copy link
Contributor

Ive removed duplicate, as its vaguely connected to other PR, which has tad different way of getting size.

Copy link
Contributor

@ropalka ropalka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is correct. The underlying protocol can be either AJP or HTTP 1.1 or HTTP2.

public static final ExchangeAttribute INSTANCE = new RequestSizeAttribute();

@Override
public String readAttribute(HttpServerExchange exchange) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if HTTP 2 protocol is in use? The calculations here expect HTTP 1.1 is being used.

public static final ExchangeAttribute INSTANCE = new ResponseSizeAttribute();

@Override
public String readAttribute(HttpServerExchange exchange) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if HTTP 2 protocol is in use? The calculations here expect HTTP 1.1 is being used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, but AFAIR we cant account for, for instance, header compression? Also, even for H1 with compression this will be off?
@xjusko ^^ ?

@baranowb baranowb self-requested a review July 31, 2024 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances existing behaviour or code new feature/API change New feature to be introduced or a change to the API (non suitable to minor releases) under verification Currently being verified (running tests, reviewing) before posting a review to contributor waiting peer review PRs that edit core classes might require an extra review
Projects
None yet
3 participants