-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add quarkus.rest-client.multipart.max-chunk-size property #35982
Conversation
WDYT @geoand? |
Looks good on a first pass. Have you tested it? |
...untime/src/main/java/org/jboss/resteasy/reactive/client/api/QuarkusRestClientProperties.java
Show resolved
Hide resolved
2fbf5c4
to
200bb9d
Compare
@geoand I added some unit tests. I'm trying to include some integration tests but I'm lacking creativity at the moment. Any suggestion? |
I would like to see something like: public class ChunkedSizeTest {
@RegisterExtension
static final QuarkusUnitTest TEST = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar.addClasses(TestClient.class, TestResource.class))
.withConfigurationResource("chunked-size-test-application.properties");
@Test
public void test() throws Exception {
// ensure that the response is what you expect
}
@Path("test")
public interface TestClient {
@POST
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.TEXT_PLAIN)
String test(byte[] input);
}
@Path("test")
public static class TestResource {
@POST
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.TEXT_PLAIN)
public String test(@Context HttpHeaders headers, byte[] input) {
return input.length + "/" + headers.getLength() + "/" + headers.getHeaderString("transfer-encoding");
}
}
} |
BTW, has this been tested against the server API mentioned in #35915? |
...ive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java
Outdated
Show resolved
Hide resolved
Not yet. |
0a6f8b5
to
1ee31ce
Compare
@geoand what is the expected behaviour when the multipart request content fits into a single chunk? Line 845 in f974941
Although there are servers which does not support payloads encoded into chunks, as trello API for example. |
Hm... We took that from Netty and this issue seems to be exactly the same. If I were you, I'd remove that check for multipart in a separate commit and run the tests to see what happens. |
Wondering if the property name is explicit enough for developers to learn on their own that it is a specific configuration for multi-part requests. It might be wiser to add the intermediate level ("quarkus.rest-client.multipart.max-chunk-size") to make the configuration explict. WDTY? |
+1 |
a48ef94
to
1bd782f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. |
if (fullRequest.content() != chunkContent && chunkContent != null) { | ||
fullRequest.content().clear().writeBytes(chunkContent); | ||
chunkContent.release(); | ||
} else if (chunkContent == null) { | ||
isChunked = true; | ||
removeChunkedFromTransferEncoding(headers); | ||
} | ||
return fullRequest; | ||
return new WrappedHttpRequest(fullRequest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain these changes please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without these changes, shouldSendFromMultiEmittingOutsideEventLoop
and shouldUploadSlowlyProducedData
test cases will fail (as you can see in the previous CI report).
The fetched HTTP chunk can be a null value and the request's content has to be marked as chunked because of that (based on my observation). Otherwise, an NPE will be thrown because the source buffer (i.e. the chunk) is a null value.
The reason for the buffer to be a null value on these test cases is unfortunately to be determined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think we can live with it as long as CI passes and as long as #35915 is fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could ask to the netty team what they think about these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not burden them unless we really need to.
The test looks good I agree, but we really need to test this against the real problematic server otherwise we can't close the issue 😉 |
That's awesome, thanks! |
Closes #35915