X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_response_object.c;h=fc4bf22536ffd4383d3efaa5d8272ce65741f3b4;hp=7d2f390c1644d96d0556d14b84dc2185c336b394;hb=16c91f9f50ef056c6c398cd1467b3fd40bac840d;hpb=f51ba0ea2cab12b66e684a803197c0aad4d34f67 diff --git a/http_response_object.c b/http_response_object.c index 7d2f390..fc4bf22 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -573,8 +573,8 @@ PHP_METHOD(HttpResponse, guessContentType) { zval *data = GET_STATIC_PROP(data); ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(data), Z_STRLEN_P(data), SEND_DATA); + break; } - break; case SEND_RSRC: { @@ -583,12 +583,12 @@ PHP_METHOD(HttpResponse, guessContentType) z->type = IS_RESOURCE; php_stream_from_zval(s, &z); ct = http_guess_content_type(magic_file, magic_mode, s, 0, SEND_RSRC); + break; } - break; default: ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(GET_STATIC_PROP(file)), 0, -1); - break; + break; } if (ct) { UPD_STATIC_PROP(string, contentType, ct); @@ -1094,7 +1094,11 @@ PHP_METHOD(HttpResponse, send) cctl = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(cacheControl), &cctl_p); if (Z_LVAL_P(lmod) || Z_STRLEN_P(etag)) { - http_send_cache_control(Z_STRVAL_P(cctl), Z_STRLEN_P(cctl)); + if (Z_STRLEN_P(cctl)) { + http_send_cache_control(Z_STRVAL_P(cctl), Z_STRLEN_P(cctl)); + } else { + http_send_cache_control(HTTP_DEFAULT_CACHECONTROL, lenof(HTTP_DEFAULT_CACHECONTROL)); + } if (Z_STRLEN_P(etag)) { http_send_etag(Z_STRVAL_P(etag), Z_STRLEN_P(etag)); } @@ -1156,8 +1160,7 @@ PHP_METHOD(HttpResponse, send) php_start_ob_buffer(NULL, HTTP_G->send.buffer_size, 0 TSRMLS_CC); /* send */ - switch (Z_LVAL_P(GET_STATIC_PROP(mode))) - { + switch (Z_LVAL_P(GET_STATIC_PROP(mode))) { case SEND_DATA: { zval *zdata_p, *zdata = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(data), &zdata_p); @@ -1210,7 +1213,7 @@ PHP_METHOD(HttpResponse, capture) UPD_STATIC_PROP(long, catch, 1); php_end_ob_buffers(0 TSRMLS_CC); - php_start_ob_buffer(NULL, 40960, 0 TSRMLS_CC); + php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC); /* register shutdown function */ {