oknet commented on PR #10965:
URL: https://github.com/apache/trafficserver/pull/10965#issuecomment-1880534145
By review your current code, let me confirm the implement and details with
you:
1. dispatch HTTP request directly except ( POST and PUT )
2. For the POST and PUT request with valid `Content-Length` header,
a. Collect data into `s.origin_buffer` by transform plugin,
b. Get all data by `s.clone_reader` while the transformVC closed,
c. Then dispatch the request.
3. For the POST and PUT request without `Content-Length` header, does not
dispatch the request.
I'll approve your commit if the above list is all you have done at this
stage.
For step 2.a, the data is kept in memory until all data is received, this is
not a good design, I hope you can improve the design in the future.
Correction for my last comment:
If the POST payload is chunked, the `HttpTunnel` decodes the chunked data
**and verifies the integrity of the chunked data, but it still writes the
unchanged data** to `TransformVC`. But the `HttpSM` does not re-chunk the data
received from `TransformVC`, even `HttpTunnel` can do it.
In addition to chunking, there is also `Content-Type: multipart/mixed` type
which not supported by `HttpSM` and `HttpTunnel`. Maybe that's why the
`HttpTunnel` only validates the request's payload and passes it unchanged to
`transformVC`.
For those requests without a "Content-Length" header, you can defer calling
`TSVConnWrite(output_vconn, ...)` till upstream's `vio->ntodo() == 0`, and you
have to copy all data from `upsteam’s vio` to a temporary `IOBuffer` then
consume all data from `upstream's vio` in order to make NetHandler read more
data.
https://github.com/apache/trafficserver/blob/8f5d558461cc0ad2f91f579f40754678c2e6803a/plugins/multiplexer/post.cc#L75
The upstream's `vio->ntodo() == 0` means all data was sent. (refer to
doc/developer-guide/plugins/io/transformations.en.rst )
https://github.com/apache/trafficserver/blob/8f5d558461cc0ad2f91f579f40754678c2e6803a/doc/developer-guide/plugins/io/transformations.en.rst?plain=1#L156-L163
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]