You are not logged in.
Hi ab,
since commit #ebba3ec http response in browser client is compressed because of this line in mormot.net.http.pas:
compressible := IsContentTypeCompressible(pointer(OutContentType));
Do I have to set/config something to prevent this?
My ContentType is application/json.
When changing line 8903 in mormot.core.buffers.pas to this
_CONTENT_APP: array[0..4] of PUtf8Char = (
'APPLICATION/JSON', <-- this works for me
'XML',
'JAVASCRIPT',
'VND.API+JSON',
nil);
it work as expected.
Daniel
Last edited by danielkuettner (2024-07-26 08:59:02)
Offline
Shouldn't application/json be compressed?
I have included some associated regression tests:
https://github.com/synopse/mORMot2/commit/50c20c00
Offline
I'm not the one who defines which ContentType hast to be compressed. But over the last 10 years I'm using this ContentType and it was never compressed.
Should be compressing not independent from ContentTypes and compressing tagged by other headers:
Content-Type:application/json - tells what type of content data in the http call
Content-Encoding: gzip - tells what compression being used
Anyway, I need a way to disable compressing, because it isn't nice to decompress synlz compressed responses by browser/js.
Last edited by danielkuettner (2024-07-26 15:21:08)
Offline
You are right, a browser is not able to handle SynLZ compression.
But since the browser does not add the "SynLZ" compression int its supported encoding, the server should never use this compression.
In CompressContent(), SynLZ should never be part of the Accepted: THttpSocketCompressSet value, so the browser should never use SynLZ.
Only if the browser notify about "gzip", then the server would try to compress using gzip.
Offline
The problem is in unit mormot.net.http.pas line 2770
for i := 1 to length(Handled) do
correct would be
for i := 0 to length(Handled) do
Offline
Oh yes, there was a regression about the index in Accepted.
SHould be fixed now with
https://github.com/synopse/mORMot2/commit/a94b7249
Thanks a lot Marcio for your very valuable input!
Offline
@Márcio Baroni
Thanks a lot
Offline