}
}
-PHP_HTTP_API php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body)
+PHP_HTTP_API const php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body)
{
TSRMLS_FETCH_FROM_CTX(body->ts);
php_stream_stat(php_http_message_body_stream(body), &body->ssb);
{
TSRMLS_FETCH_FROM_CTX(body->ts);
php_stream *s = php_http_message_body_stream(body);
+ char *buf = emalloc(0x1000);
php_stream_seek(s, offset, SEEK_SET);
forlen = -1;
}
while (!php_stream_eof(s)) {
- char buf[0x1000];
- size_t read = php_stream_read(s, buf, MIN(forlen, sizeof(buf)));
+ size_t read = php_stream_read(s, buf, MIN(forlen, 0x1000));
if (read) {
cb(cb_arg, buf, read);
break;
}
}
+ efree(buf);
}
PHP_HTTP_API size_t php_http_message_body_append(php_http_message_body_t *body, const char *buf, size_t len)
--HASH_OF(value)->nApplyCount;
}
} else {
- zval *cpy = php_http_zsep(IS_STRING, value);
+ zval *cpy = php_http_ztyp(IS_STRING, value);
php_http_message_body_add_field(body, name, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy));
zval_ptr_dtor(&cpy);
}
&& (SUCCESS == zend_hash_find(HASH_OF(value), ZEND_STRS("file"), (void *) &zfile))
&& (SUCCESS == zend_hash_find(HASH_OF(value), ZEND_STRS("type"), (void *) &ztype))
) {
- zval *zfc = php_http_zsep(IS_STRING, *zfile), *znc = php_http_zsep(IS_STRING, *zname), *ztc = php_http_zsep(IS_STRING, *ztype);
+ zval *zfc = php_http_ztyp(IS_STRING, *zfile), *znc = php_http_ztyp(IS_STRING, *zname), *ztc = php_http_ztyp(IS_STRING, *ztype);
char *str = format_key(HASH_KEY_IS_STRING, Z_STRVAL_P(znc), 0, name);
STATUS ret = php_http_message_body_add_file(body, str, Z_STRVAL_P(zfc), Z_STRVAL_P(ztc));
zval *zstream = NULL;
php_stream *stream;
- with_error_handling(EH_THROW, PHP_HTTP_EX_CE(runtime)) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r!", &zstream)) {
if (zstream) {
php_stream_from_zval(stream, &zstream);