mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-19 20:14:18 -04:00
Check for zlib 1.2.0 or better for gzip content-encoding
This commit is contained in:
parent
cfe3c7675a
commit
f044f7331e
@ -42,6 +42,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
@ -387,6 +388,15 @@ int config_read(char *file) {
|
||||
}
|
||||
}
|
||||
|
||||
/* must have zlib 1.2 or better for gzip encoding support */
|
||||
if(!strncmp(ZLIB_VERSION,"0.",2) ||
|
||||
!strncmp(ZLIB_VERSION,"1.0",3) ||
|
||||
!strncmp(ZLIB_VERSION,"1.1",3)) {
|
||||
config.compress=0;
|
||||
DPRINTF(E_LOG,L_CONF,"Must have zlib > 1.2.0 to use gzip content encoding. You have %s. Sucks, huh?\n",ZLIB_VERSION);
|
||||
}
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,16 @@ DAAP_BLOCK *daap_add_formatted(DAAP_BLOCK *parent, char *tag,
|
||||
|
||||
GZIP_STREAM *gzip_alloc(void) {
|
||||
GZIP_STREAM *gz = malloc(sizeof(GZIP_STREAM));
|
||||
gz->in_size = GZIP_CHUNK;
|
||||
gz->in = malloc(gz->in_size);
|
||||
gz->bytes_in = 0;
|
||||
gz->out = NULL;
|
||||
gz->bytes_out = 0;
|
||||
|
||||
if(gz) {
|
||||
memset(gz,0x00,sizeof(GZIP_STREAM));
|
||||
|
||||
gz->in_size = GZIP_CHUNK;
|
||||
gz->in = malloc(gz->in_size);
|
||||
gz->bytes_in = 0;
|
||||
gz->out = NULL;
|
||||
gz->bytes_out = 0;
|
||||
}
|
||||
return gz;
|
||||
}
|
||||
|
||||
@ -94,6 +99,8 @@ int gzip_compress(GZIP_STREAM *gz) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset((void*)&strm,0x00,sizeof(strm));
|
||||
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
@ -101,7 +108,7 @@ int gzip_compress(GZIP_STREAM *gz) {
|
||||
strm.avail_in = gz->bytes_in;
|
||||
strm.next_out = gz->out;
|
||||
strm.avail_out = out_size;
|
||||
deflateInit2(&strm,GZIP_COMPRESSION_LEVEL,Z_DEFLATED,31,8,Z_DEFAULT_STRATEGY);
|
||||
deflateInit2(&strm,GZIP_COMPRESSION_LEVEL,Z_DEFLATED,24,8,Z_DEFAULT_STRATEGY);
|
||||
while ((status = deflate(&strm,Z_FINISH)) == Z_OK)
|
||||
;
|
||||
if (status != Z_STREAM_END) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user