Closed Xiretza closed 2 months ago
the request fail on the client
When you say client, what are you referring to? Are you seeing this between synapse <-> synapse or synapse <-> another homeserver implementation?
The response in /tmp/response is a complete and correct response containing two parts, the second of which is the correct thumbnail. It is 1189 bytes in size in total.
Just to clarify, when you say a complete and correct response, you mean the response contains the json object + field, ie:
Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08jU534c0p
--gc0p4Jq0M2Yt08jU534c0p
Content-Type: application/json
{}
plus the second field which is the thumbnail bytes, and both of these fields add up to 1189 bytes?
When you say client, what are you referring to? Are you seeing this between synapse <-> synapse or synapse <-> another homeserver implementation?
Another federating homeserver, in this case grapevine, where I'm trying to implement Authenticated Media support. Synapse would likely have the same problem as a client, but it doesn't request /_matrix/federation/v1/media/thumbnail/
over federation and instead always fetches the complete media and does the thumbnailing itself; this is probably why the issue hasn't been spotted so far.
Just to clarify, when you say a complete and correct response, you mean the response contains the json object + field, ie:
Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08jU534c0p --gc0p4Jq0M2Yt08jU534c0p Content-Type: application/json {}
plus the second field which is the thumbnail bytes, and both of these fields add up to 1189 bytes?
That's correct.
Thanks for reporting this - I think what happened is that the content-length was being calculated based off of the length of the original media file, rather than the thumbnail media file. Hopefully this is fixed in #17532, and since Synapse doesn't make requests to this endpoint (which, as you correctly noted, is why this was missed so far) I added a complement test to ensure the basic functionality of the endpoint.
Description
When requesting a thumbnail via the new Authenticated Media federation endpoint
/_matrix/federation/v1/media/thumbnail/{mediaId}
, synapse v1.111.0 sends aContent-Length
header that's larger than the actual response body. This makes the request fail on the client with e.g. "unexpected EOF"/"connection reset".Steps to reproduce
Redacted
curl
command line:The response in
/tmp/response
is a complete and correct response containing two parts, the second of which is the correct thumbnail. It is1189
bytes in size in total.As can be seen, the
Content-Length
header is set to3961
, which is way longer than the actual response.The log (see below) also shows the correct length of
1189
.Homeserver
xiretza.xyz
Synapse Version
v1.111.0
Installation Method
Other (please mention below)
Database
postgresql
Workers
Single process
Platform
Arch Linux, x86_64
Configuration
Nothing special
Relevant log output
Anything else that would be useful to know?
No response