return FAILURE;
}
- Z.zalloc = Z_NULL;
- Z.zfree = Z_NULL;
- Z.opaque = Z_NULL;
+ *encoded = NULL;
+ *encoded_len = 0;
+ memset(&Z, 0, sizeof(z_stream));
+
Z.next_in = (Bytef *) data;
Z.avail_in = data_len;
Z.avail_out = HTTP_ENCODING_BUFLEN(data_len) + HTTP_ENCODING_SAFPAD - 1;
}
}
- efree(*encoded);
+ STR_SET(*encoded, NULL);
http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Could not gzencode data: %s", zError(status));
return FAILURE;
}
z_stream Z;
STATUS status = Z_OK;
- Z.zalloc = Z_NULL;
- Z.zfree = Z_NULL;
- Z.opaque = Z_NULL;
+ *encoded = NULL;
+ *encoded_len = 0;
+ memset(&Z, 0, sizeof(z_stream));
+
Z.data_type = Z_UNKNOWN;
Z.next_in = (Bytef *) data;
Z.avail_in = data_len;
}
}
- efree(encoded);
+ STR_SET(*encoded, NULL);
http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Could not deflate data: %s", zError(status));
return FAILURE;
}
STATUS status;
z_stream Z;
+ *decoded = NULL;
+ *decoded_len = 0;
+ memset(&Z, 0, sizeof(z_stream));
+
do {
- Z.zalloc = Z_NULL;
- Z.zfree = Z_NULL;
-
if (!max) {
*decoded_len = data_len * 2;
*decoded = emalloc(*decoded_len + 1);
}
} while (status == Z_BUF_ERROR && ++max < HTTP_ENCODING_MAXTRY);
- efree(*decoded);
+ STR_SET(*decoded, NULL);
http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Could not inflate data: %s", zError(status));
return FAILURE;
}
INIT_PZVAL(&zsupported);
array_init(&zsupported);
add_next_index_stringl(&zsupported, "gzip", lenof("gzip"), 1);
+ add_next_index_stringl(&zsupported, "x-gzip", lenof("x-gzip"), 1);
add_next_index_stringl(&zsupported, "deflate", lenof("deflate"), 1);
HTTP_G(send).gzip_encoding = 0;
ulong idx;
if (HASH_KEY_IS_STRING == zend_hash_get_current_key(selected, &encoding, &idx, 0) && encoding) {
- if (!strcmp(encoding, "gzip")) {
+ if (!strcmp(encoding, "gzip") || !strcmp(encoding, "x-gzip")) {
if (SUCCESS == (hs = http_send_header_string("Content-Encoding: gzip"))) {
HTTP_G(send).gzip_encoding = HTTP_ENCODING_GZIP;
}