}
if (!ct_len) {
- RETURN_SUCCESS(http_send_content_type("application/x-octetstream", sizeof("application/x-octetstream") - 1));
+ RETURN_SUCCESS(http_send_content_type("application/x-octetstream", lenof("application/x-octetstream")));
}
RETURN_SUCCESS(http_send_content_type(ct, ct_len));
}
}
if (for_range) {
- RETURN_BOOL(http_modified_match("HTTP_IF_UNMODIFIED_SINCE", t));
+ RETURN_BOOL(http_match_last_modified("HTTP_IF_UNMODIFIED_SINCE", t));
}
- RETURN_BOOL(http_modified_match("HTTP_IF_MODIFIED_SINCE", t));
+ RETURN_BOOL(http_match_last_modified("HTTP_IF_MODIFIED_SINCE", t));
}
/* }}} */
}
if (for_range) {
- RETURN_BOOL(http_etag_match("HTTP_IF_MATCH", etag));
+ RETURN_BOOL(http_match_etag("HTTP_IF_MATCH", etag));
}
- RETURN_BOOL(http_etag_match("HTTP_IF_NONE_MATCH", etag));
+ RETURN_BOOL(http_match_etag("HTTP_IF_NONE_MATCH", etag));
}
/* }}} */
/* {{{ proto bool http_cache_last_modified([int timestamp_or_expires]])
*
- * If timestamp_or_exires is greater than 0, it is handled as timestamp
+ * If timestamp_or_expires is greater than 0, it is handled as timestamp
* and will be sent as date of last modification. If it is 0 or omitted,
* the current time will be sent as Last-Modified date. If it's negative,
* it is handled as expiration time in seconds, which means that if the
send_modified = last_modified;
}
- RETURN_SUCCESS(http_cache_last_modified(last_modified, send_modified, HTTP_DEFAULT_CACHECONTROL, sizeof(HTTP_DEFAULT_CACHECONTROL) - 1));
+ RETURN_SUCCESS(http_cache_last_modified(last_modified, send_modified, HTTP_DEFAULT_CACHECONTROL, lenof(HTTP_DEFAULT_CACHECONTROL)));
}
/* }}} */
RETURN_FALSE;
}
- RETURN_SUCCESS(http_cache_etag(etag, etag_len, HTTP_DEFAULT_CACHECONTROL, sizeof(HTTP_DEFAULT_CACHECONTROL) - 1));
+ RETURN_SUCCESS(http_cache_etag(etag, etag_len, HTTP_DEFAULT_CACHECONTROL, lenof(HTTP_DEFAULT_CACHECONTROL)));
}
/* }}} */
-/* {{{ proto string ob_httpetaghandler(string data, int mode)
+/* {{{ proto string ob_etaghandler(string data, int mode)
*
* For use with ob_start().
- * Note that this has to be started as first output buffer.
- * WARNING: Don't use with http_send_*().
*/
-PHP_FUNCTION(ob_httpetaghandler)
+PHP_FUNCTION(ob_etaghandler)
{
char *data;
int data_len;
RETURN_FALSE;
}
- if (mode & PHP_OUTPUT_HANDLER_START) {
- if (HTTP_G(etag_started)) {
- http_error(E_WARNING, HTTP_E_OBUFFER, "ob_httpetaghandler can only be used once");
- RETURN_STRINGL(data, data_len, 1);
- }
- http_send_header("Cache-Control: " HTTP_DEFAULT_CACHECONTROL);
- HTTP_G(etag_started) = 1;
- }
-
- if (OG(ob_nesting_level) > 1) {
- http_error(E_WARNING, HTTP_E_OBUFFER, "ob_httpetaghandler must be started prior to other output buffers");
- RETURN_STRINGL(data, data_len, 1);
- }
-
Z_TYPE_P(return_value) = IS_STRING;
http_ob_etaghandler(data, data_len, &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), mode);
}
}
convert_to_string_ex(&zdata);
- http_send_header("Accept-Ranges: bytes");
RETURN_SUCCESS(http_send_data(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)));
}
/* }}} */
RETURN_FALSE;
}
- http_send_header("Accept-Ranges: bytes");
RETURN_SUCCESS(http_send_file(file));
}
/* }}} */
}
php_stream_from_zval(file, &zstream);
- http_send_header("Accept-Ranges: bytes");
RETURN_SUCCESS(http_send_stream(file));
}
/* }}} */
RETURN_FALSE;
}
- if (SUCCESS == http_chunked_decode(encoded, encoded_len, &decoded, &decoded_len)) {
+ if (NULL != http_chunked_decode(encoded, encoded_len, &decoded, &decoded_len)) {
RETURN_STRINGL(decoded, decoded_len, 0);
} else {
RETURN_FALSE;
* <?php
* array(
* 0 => array(
- * 'Status' => '200 Ok',
+ * 'Response Status' => '200 Ok',
* 'Content-Type' => 'text/plain',
* 'Content-Language' => 'en-US'
* ),
*/
PHP_FUNCTION(http_parse_headers)
{
- char *header, *rnrn;
+ char *header;
int header_len;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &header, &header_len)) {
}
array_init(return_value);
-
- if (rnrn = strstr(header, HTTP_CRLF HTTP_CRLF)) {
- header_len = rnrn - header + 2;
- }
- if (SUCCESS != http_parse_headers(header, header_len, return_value)) {
+ if (SUCCESS != http_parse_headers(header, return_value)) {
http_error(E_WARNING, HTTP_E_PARSE, "Could not parse HTTP headers");
zval_dtor(return_value);
RETURN_FALSE;
* - lastmodified: int, timestamp for If-(Un)Modified-Since header
* - timeout: int, seconds the request may take
* - connecttimeout: int, seconds the connect may take
+ * - onprogress: mixed, progress callback
+ * - ondebug: mixed, debug callback
* </pre>
*
* The optional third parameter will be filled with some additional information
PHP_FUNCTION(http_test)
{
+ RETURN_NULL();
}
/*