X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_send_api.h;h=dd0b50a0db2ca9f2f8a548991519dd2b743e777b;hp=9abf1a5718086900e8cbda4cc5f71a9900baa35c;hb=669d2e6a8bdc642b6b52693f4593f199ddd7e8d2;hpb=32e91737086db53bb1fd9ed9f79d693c43ec459f diff --git a/php_http_send_api.h b/php_http_send_api.h index 9abf1a5..dd0b50a 100644 --- a/php_http_send_api.h +++ b/php_http_send_api.h @@ -15,11 +15,20 @@ #ifndef PHP_HTTP_SEND_API_H #define PHP_HTTP_SEND_API_H -typedef enum { +typedef enum _http_send_mode_t { SEND_DATA, SEND_RSRC } http_send_mode; +#define HTTP_REDIRECT 0L +#define HTTP_REDIRECT_PERM 301L +#define HTTP_REDIRECT_FOUND 302L +#define HTTP_REDIRECT_POST 303L +#define HTTP_REDIRECT_PROXY 305L +#define HTTP_REDIRECT_TEMP 307L + +extern PHP_MINIT_FUNCTION(http_send); + #define http_send_status(s) sapi_header_op(SAPI_HEADER_SET_STATUS, (void *) (s) TSRMLS_CC) #define http_send_header(n, v, r) _http_send_header_ex((n), strlen(n), (v), strlen(v), (r) TSRMLS_CC) #define http_send_header_ex(n, nl, v, vl, r, s) _http_send_header_ex((n), (nl), (v), (vl), (r), (s) TSRMLS_CC) @@ -52,8 +61,8 @@ PHP_HTTP_API STATUS _http_send_content_disposition(const char *filename, size_t #define http_send_ex(d, s, m, nc) _http_send_ex((d), (s), (m), (nc) TSRMLS_CC) PHP_HTTP_API STATUS _http_send_ex(const void *data, size_t data_size, http_send_mode mode, zend_bool no_cache TSRMLS_DC); -#define http_send_file(f) http_send_stream_ex(php_stream_open_wrapper(f, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL), 1, 0) -#define http_send_file_ex(f, nc) http_send_stream_ex(php_stream_open_wrapper(f, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL), 1, (nc)) +#define http_send_file(f) http_send_stream_ex(php_stream_open_wrapper_ex(f, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL, HTTP_DEFAULT_STREAM_CONTEXT), 1, 0) +#define http_send_file_ex(f, nc) http_send_stream_ex(php_stream_open_wrapper_ex(f, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL, HTTP_DEFAULT_STREAM_CONTEXT), 1, (nc)) #define http_send_stream(s) http_send_stream_ex((s), 0, 0) #define http_send_stream_ex(s, c, nc) _http_send_stream_ex((s), (c), (nc) TSRMLS_CC) PHP_HTTP_API STATUS _http_send_stream_ex(php_stream *s, zend_bool close_stream, zend_bool no_cache TSRMLS_DC);