- fix segv with http.send.deflate.start_auto=1 and http_send_*()
[m6w6/ext-http] / http_send_api.c
index 0c1fe57cfdbcadbd0d12a6183ee6debf365837f3..2be92b62dec675c02fd141aaeb65dc3c30ac0391 100644 (file)
@@ -65,7 +65,7 @@ static inline void _http_send_response_start(void **buffer, size_t content_lengt
 #define http_send_response_data_plain(b, d, dl) _http_send_response_data_plain((b), (d), (dl) TSRMLS_CC)
 static inline void _http_send_response_data_plain(void **buffer, const char *data, size_t data_len TSRMLS_DC)
 {
 #define http_send_response_data_plain(b, d, dl) _http_send_response_data_plain((b), (d), (dl) TSRMLS_CC)
 static inline void _http_send_response_data_plain(void **buffer, const char *data, size_t data_len TSRMLS_DC)
 {
-       if (HTTP_G->send.deflate.encoding) {
+       if (HTTP_G->send.deflate.encoding && *(http_encoding_stream **) buffer) {
 #ifdef HTTP_HAVE_ZLIB
                char *encoded;
                size_t encoded_len;
 #ifdef HTTP_HAVE_ZLIB
                char *encoded;
                size_t encoded_len;
@@ -137,7 +137,7 @@ static inline void _http_send_response_data_fetch(void **buffer, const void *dat
 #define http_send_response_finish(b) _http_send_response_finish((b) TSRMLS_CC)
 static inline void _http_send_response_finish(void **buffer TSRMLS_DC)
 {
 #define http_send_response_finish(b) _http_send_response_finish((b) TSRMLS_CC)
 static inline void _http_send_response_finish(void **buffer TSRMLS_DC)
 {
-       if (HTTP_G->send.deflate.encoding) {
+       if (HTTP_G->send.deflate.encoding && *(http_encoding_stream **) buffer) {
 #ifdef HTTP_HAVE_ZLIB
                char *encoded = NULL;
                size_t encoded_len = 0;
 #ifdef HTTP_HAVE_ZLIB
                char *encoded = NULL;
                size_t encoded_len = 0;