Compression nor working properly for web server in vertx - compression

I enabled brotli compression on server side in vertex by added a compressor with StandardCompressionOptions.brotli() and enabled setCompressionSupported(true) on server option before creating server.
But In response I am getting compressed data appended to uncompressed data in response.
This is happening for brotli compression only.
How can get rid of uncompressed data coming with compressed data

Related

GCP Cloud CDN will not compress content when set to "Automatic"

GCP Cloud CDN does not compress any responses when the strategy for compression is set to AUTOMATIC (as it should per the docs) (UI of the CDN in question).
No compression takes place, and no content-encoding header is sent, even tho an accept-encoding header (gzip, deflate, br) is sent.
A prime example of an ~300kb file not being compressed appropriately can be found behind a CDN here: https://himmer.software/main.6a971e1e28a0da9a.js (as of 30.11.2022). The object in question in the connected backend bucket: Object
I feel I must be overseeing something, the mime type and request headers are correct, so having the compression mode set to automatic should return a compressed version of the object.
I set compression mode to AUTOMATIC, set back to DISABLED and back to AUTOMATIC, ran v1.compute.urlMaps.invalidateCache with /* on the load balancer (invalidated all records AFAICT), but still nothing.
Are you using the new Google Global Load Balancer or the Classic Load Balancer? Dynamic compression is not currently supported on the new GCLB option, only the Classic GCLB at this time.

Compressing the request data sent to django server

I would like to be able to compress the data sent from a client to a django server.
The data I need to compress is mainly binary, but some endpoints receive also large jsons with binary data encoded to base64.
I've found lots of info regarding the opposite way (server returning compressed response) for example https://docs.djangoproject.com/en/1.2/ref/middleware/#module-django.middleware.gzip, however this is not what I need.
What I'm basically asking is:
Is there a standard/recommended way for compressing client requests? gzip, LZW, Huffman...
How do I support this in Django?
Responses:
1 - You could compress the data on the client and then send it to the server. I've seen Javascript libraries to compress to ZIP. The data can be uncompressed on the server.
2 - Uncompress the request parameter using Python zip library.

Video streaming through web service and rendering - Any Issues?

We have a web service that sends the video content in the response as binary (in different formats asx, asf, ram, mpeg, mpg, mpe, qt, mov, avi, movie, wmv, smil, mp4, mxf, gxf, flv, 3gp, f4v, mj2, omf, dv, vob).
Do you see any issue with performance, if I have an intermediate application which makes a request to web service to retrieve video content and render in browser?
Thanks
As long as the web service returns binary data directly, then there will be no performance hit. If this is an XML or SOAP web service that wraps the whole thing in a SOAP envelope and bae64 encodes it to make it all text, then you will not be able to play it directly and it will have a big impact on bandwidth, cpu, and memory.
Also note that by serving the video directly instead of using a true streaming protocol the user will only be able to seek within the portion downloaded so far. A streaming protocol like RTSP, RTMP, or the many varieties of HTTP Streaming allow seeking to any part of the file and only downloading the part seeked to.

Compression HTTP

Is it possible to POST request data from browser to server in compressed format?
If yes, How can we do that?
Compressing data sent from the browser to the server is not natively supported in the browsers.
You'll have to find a workaround, using a clientside language (maybe a JavaScript GZip implementation, or a Java Applet, or ...). Be sure to visually display to the user what the browser is doing and why it is taking some time.
I don't know the scope of your application, but on company websites you could just restrict input to compressed files. Ask your users to upload .zip/.7z/.rar/... files.
The server->client responses can be gzip compressed automagically by the server.
Compressing the client->server messages is not standard, so will require some work by you. Take your very large POST data and compress it client-side, using JavaScript. Then decompress it manually on the server side.
This will usually not be a beneficial thing to do unless your bandwidth usage is a major bottleneck. Compression requires both time and CPU usage to perform.

How to copy multiple files from server to local hard disk in one http request using C++?

How do you copy a group of files from server machine to local hard disk through a C++ web application in one request? This is kind of downloading bulk files to your local machine from a server. I guess in Java you could do this through ZipInputStream and GZipInputStream.
Is it possible to achieve this entirely through server side code? Or will it require a client running on the local machine to carry out the bulk copying of files?
Say you have a Java servlet / ISAPI extension that accepts requests of the form
http://server:port/fileserver?f=FILE1&f=FILE2&.....&f=FILEN
On receipt of such a request, the server side code can, using zlib, pack all the files into a zip file and send the zip file as the HTTP response setting the Content-Type, Content-Length, Last-Modified,etc.
Further Note: If you are using ISAPI on IIS6 and above, you can also add this content into the IIS's kernel mode response cache.
If the user if aware of this, and the files are not nessesary for website rendering, you can push them into an archive and have a link from your site (or do something like sourceforge, redirect to the archive and the browser simply downloads it. For archiving you can use zlib. Just send Content-type as gzip and push data (here from stdin)
int ret;
/* avoid end-of-line conversions */
SET_BINARY_MODE(stdin);
SET_BINARY_MODE(stdout);
ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);
if (ret != Z_OK)
zerr(ret);
return ret;
If you are trying to have the whole page (HTML, CSS, JS, IMG) sent as one, all of those files can be inserted into HTML, even images. (see this).