}
spprintf(&cd, 0, HTTP_CONTENTDISPOSITION_TEMPLATE, send_inline ? "inline" : "attachment", file);
- ZVAL_STRING_FREE(GET_STATIC_PROP(contentDisposition), cd, 0);
+ SET_STATIC_PROP_STRING(contentDisposition, cd, 0);
RETURN_TRUE;
}
/* }}} */
RETURN_FALSE;
}
- ZVAL_STRINGL_FREE(GET_STATIC_PROP(eTag), etag, etag_len, 1);
+ USE_STATIC_PROP();
+ SET_STATIC_PROP_STRINGL(eTag, etag, etag_len, 1);
RETURN_TRUE;
}
/* }}} */
/* interrupt on-the-fly etag generation */
HTTP_G(etag).started = 0;
/* discard previous output buffers */
- //php_end_ob_buffers(0 TSRMLS_CC);
+ php_end_ob_buffers(0 TSRMLS_CC);
}
/* gzip */
if (Z_LVAL_P(GET_STATIC_PROP(gzip))) {
php_start_ob_buffer_named("ob_gzhandler", 0, 1 TSRMLS_CC);
+ } else {
+ php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
}
/* caching */
lmod = GET_STATIC_PROP(lastModified);
cctl = GET_STATIC_PROP(cacheControl);
- http_cache_etag(Z_STRVAL_P(etag), Z_STRLEN_P(etag),Z_STRVAL_P(cctl), Z_STRLEN_P(cctl));
+ http_cache_etag(Z_STRVAL_P(etag), Z_STRLEN_P(etag), Z_STRVAL_P(cctl), Z_STRLEN_P(cctl));
http_cache_last_modified(Z_LVAL_P(lmod), Z_LVAL_P(lmod) ? Z_LVAL_P(lmod) : time(NULL), Z_STRVAL_P(cctl), Z_STRLEN_P(cctl));
}
if (Z_STRLEN_P(ctype)) {
http_send_content_type(Z_STRVAL_P(ctype), Z_STRLEN_P(ctype));
} else {
- http_send_content_type("application/x-octetstream", lenof("application/x-octetstream"));
+ char *ctypes = INI_STR("default_mimetype");
+ size_t ctlen = ctypes ? strlen(ctypes) : 0;
+
+ if (ctlen) {
+ http_send_content_type(ctypes, ctlen);
+ } else {
+ http_send_content_type("application/x-octetstream", lenof("application/x-octetstream"));
+ }
}
}
if(target) efree(target); \
target = source
-#define ZVAL_STRING_FREE(z, s, d) \
- {\
- zval *__tmp = (z); \
- /*zval_ptr_dtor(&__tmp);*/ \
- ZVAL_STRING(__tmp, (s), (d)); \
- }
-#define ZVAL_STRINGL_FREE(z, s, l, d) \
- {\
- zval *__tmp = (z); \
- /*zval_ptr_dtor(&__tmp);*/ \
- ZVAL_STRINGL(__tmp, (s), (l), (d)); \
- }
-
/* return bool (v == SUCCESS) */
#define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
#define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
MAKE_STD_ZVAL(__tmp); \
ZVAL_STRING(__tmp, (s), (d)); \
SET_STATIC_PROP_EX(ce, n, __tmp); \
+ zval_dtor(__tmp); \
efree(__tmp); \
}
#define SET_STATIC_PROP_STRINGL_EX(ce, n, s, l, d) \
MAKE_STD_ZVAL(__tmp); \
ZVAL_STRINGL(__tmp, (s), (l), (d)); \
SET_STATIC_PROP_EX(ce, n, __tmp); \
+ zval_dtor(__tmp); \
efree(__tmp); \
}
# define DCL_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n), (v), (ZEND_ACC_ ##a) TSRMLS_CC)