|
|
@ -164,8 +164,9 @@ bool compress_content(string &content,
|
|
|
|
/* Compress the content if necessary */
|
|
|
|
/* Compress the content if necessary */
|
|
|
|
if (deflated) {
|
|
|
|
if (deflated) {
|
|
|
|
pthread_mutex_lock(&compressorLock);
|
|
|
|
pthread_mutex_lock(&compressorLock);
|
|
|
|
compr_buffer.reserve(COMPRESSOR_BUFFER_SIZE);
|
|
|
|
uLong bufferBound = compressBound(contentLength);
|
|
|
|
uLongf comprLen = COMPRESSOR_BUFFER_SIZE;
|
|
|
|
compr_buffer.reserve(bufferBound);
|
|
|
|
|
|
|
|
uLongf comprLen = compr_buffer.capacity();
|
|
|
|
int err = compress(&compr_buffer[0], &comprLen, (const Bytef*)(content.data()), contentLength);
|
|
|
|
int err = compress(&compr_buffer[0], &comprLen, (const Bytef*)(content.data()), contentLength);
|
|
|
|
|
|
|
|
|
|
|
|
if (err == Z_OK && comprLen > 2 && comprLen < (contentLength+2)) {
|
|
|
|
if (err == Z_OK && comprLen > 2 && comprLen < (contentLength+2)) {
|
|
|
|