message->http.version.major = 1;
message->http.version.minor = 1;
zend_hash_init(&message->hdrs, 0, NULL, ZVAL_PTR_DTOR, 0);
message->http.version.major = 1;
message->http.version.minor = 1;
zend_hash_init(&message->hdrs, 0, NULL, ZVAL_PTR_DTOR, 0);
if ((sval = php_http_env_get_server_var(ZEND_STRL("SERVER_PROTOCOL"), 1 TSRMLS_CC)) && !strncmp(Z_STRVAL_P(sval), "HTTP/", lenof("HTTP/"))) {
php_http_version_parse(&message->http.version, Z_STRVAL_P(sval) TSRMLS_CC);
}
if ((sval = php_http_env_get_server_var(ZEND_STRL("SERVER_PROTOCOL"), 1 TSRMLS_CC)) && !strncmp(Z_STRVAL_P(sval), "HTTP/", lenof("HTTP/"))) {
php_http_version_parse(&message->http.version, Z_STRVAL_P(sval) TSRMLS_CC);
}
if (!SG(sapi_headers).http_status_line || !php_http_info_parse((php_http_info_t *) &message->http, SG(sapi_headers).http_status_line TSRMLS_CC)) {
if (!(message->http.info.response.code = SG(sapi_headers).http_response_code)) {
message->http.info.response.code = 200;
if (!SG(sapi_headers).http_status_line || !php_http_info_parse((php_http_info_t *) &message->http, SG(sapi_headers).http_status_line TSRMLS_CC)) {
if (!(message->http.info.response.code = SG(sapi_headers).http_response_code)) {
message->http.info.response.code = 200;
MAKE_STD_ZVAL(h);
ZVAL_LONG(h, size);
zend_hash_update(&msg->hdrs, "Content-Length", sizeof("Content-Length"), &h, sizeof(zval *), NULL);
MAKE_STD_ZVAL(h);
ZVAL_LONG(h, size);
zend_hash_update(&msg->hdrs, "Content-Length", sizeof("Content-Length"), &h, sizeof(zval *), NULL);
- len = spprintf(&str, 0, "multipart/form-data; boundary=\"%s\"", msg->body.boundary);
+ len = spprintf(&str, 0, "multipart/form-data; boundary=\"%s\"", msg->body->boundary);
MAKE_STD_ZVAL(h);
ZVAL_STRINGL(h, str, len, 0);
zend_hash_update(&msg->hdrs, "Content-Type", sizeof("Content-Type"), &h, sizeof(zval *), NULL);
} else if (!php_http_match(Z_STRVAL_P(h), "boundary=", PHP_HTTP_MATCH_WORD)) {
zval_dtor(h);
MAKE_STD_ZVAL(h);
ZVAL_STRINGL(h, str, len, 0);
zend_hash_update(&msg->hdrs, "Content-Type", sizeof("Content-Type"), &h, sizeof(zval *), NULL);
} else if (!php_http_match(Z_STRVAL_P(h), "boundary=", PHP_HTTP_MATCH_WORD)) {
zval_dtor(h);
- Z_STRLEN_P(h) = spprintf(&Z_STRVAL_P(h), 0, "%s; boundary=\"%s\"", Z_STRVAL_P(h), msg->body.boundary);
+ Z_STRLEN_P(h) = spprintf(&Z_STRVAL_P(h), 0, "%s; boundary=\"%s\"", Z_STRVAL_P(h), msg->body->boundary);
zend_hash_update(&msg->hdrs, "Content-Type", sizeof("Content-Type"), &h, sizeof(zval *), NULL);
} else {
zval_ptr_dtor(&h);
zend_hash_update(&msg->hdrs, "Content-Type", sizeof("Content-Type"), &h, sizeof(zval *), NULL);
} else {
zval_ptr_dtor(&h);
cb(cb_arg, str.data, str.used);
php_http_buffer_dtor(&str);
cb(cb_arg, str.data, str.used);
php_http_buffer_dtor(&str);
- php_http_message_body_to_callback(&msg->body, cb, cb_arg, 0, 0);
+ php_http_message_body_to_callback(msg->body, cb, cb_arg, 0, 0);
php_http_buffer_init_ex(&str, 0x1000, 0);
message_headers(msg, &str);
php_http_buffer_init_ex(&str, 0x1000, 0);
message_headers(msg, &str);
- php_http_message_body_to_callback(&msg->body, (php_http_pass_callback_t) php_http_buffer_append, &str, 0, 0);
+ php_http_message_body_to_callback(msg->body, (php_http_pass_callback_t) php_http_buffer_append, &str, 0, 0);
php_http_message_set_info(temp, &info);
zend_hash_copy(&temp->hdrs, &from->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
php_http_message_set_info(temp, &info);
zend_hash_copy(&temp->hdrs, &from->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
if (parents) while (from->parent) {
info.type = from->parent->type;
info.http = from->parent->http;
if (parents) while (from->parent) {
info.type = from->parent->type;
info.http = from->parent->http;
php_http_message_set_info(temp->parent, &info);
zend_hash_copy(&temp->parent->hdrs, &from->parent->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
php_http_message_set_info(temp->parent, &info);
zend_hash_copy(&temp->parent->hdrs, &from->parent->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
- o->body = php_http_message_body_object_new_ex(php_http_message_body_get_class_entry(), &msg->body, &body_obj TSRMLS_CC);
- body_obj->shared = 1;
+ o->body = php_http_message_body_object_new_ex(php_http_message_body_get_class_entry(), php_http_message_body_init(&msg->body, NULL TSRMLS_CC), NULL TSRMLS_CC);
}
ov.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_object_free, NULL TSRMLS_CC);
}
ov.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_object_free, NULL TSRMLS_CC);
- php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC);
+ php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_init(&obj->message->body, NULL TSRMLS_CC), NULL TSRMLS_CC);
}
ZVAL_OBJVAL(body, obj->body, 1);
ASSOC_PROP(array, zval, "body", body);
}
ZVAL_OBJVAL(body, obj->body, 1);
ASSOC_PROP(array, zval, "body", body);
- php_http_message_body_object_t *body_obj;
- obj->body = php_http_message_body_object_new_ex(php_http_message_body_get_class_entry(), &obj->message->body, &body_obj TSRMLS_CC);
- body_obj->shared = 1;
+ php_http_message_body_addref(obj->message->body);
+ php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body, NULL TSRMLS_CC);
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_body_object_t *new_obj = zend_object_store_get_object(new_body TSRMLS_CC);
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_body_object_t *new_obj = zend_object_store_get_object(new_body TSRMLS_CC);
- php_http_message_body_to_callback(new_obj->body, (php_http_pass_callback_t) php_http_message_body_append, &obj->message->body, 0, 0);
+ php_http_message_body_to_callback(new_obj->body, (php_http_pass_callback_t) php_http_message_body_append, obj->message->body, 0, 0);
}
if ((header = php_http_message_header(obj->message, header_str, header_len, 0))) {
}
if ((header = php_http_message_header(obj->message, header_str, header_len, 0))) {
char *name = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
if (!obj->message) {
char *name = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
if (!obj->message) {
}
array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, append, ARRAY_JOIN_STRONLY|ARRAY_JOIN_PRETTIFY);
}
array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, append, ARRAY_JOIN_STRONLY|ARRAY_JOIN_PRETTIFY);
}
php_http_version_to_string(&obj->message->http.version, &str, &len, NULL, NULL TSRMLS_CC);
}
php_http_version_to_string(&obj->message->http.version, &str, &len, NULL, NULL TSRMLS_CC);
if ((msg = php_http_message_parse(NULL, serialized, (size_t) length, 1 TSRMLS_CC))) {
obj->message = msg;
} else {
if ((msg = php_http_message_parse(NULL, serialized, (size_t) length, 1 TSRMLS_CC))) {
obj->message = msg;
} else {
}
RETVAL_OBJVAL(php_http_message_object_new_ex(obj->zo.ce, php_http_message_copy_ex(obj->message, NULL, 0), NULL TSRMLS_CC), 0);
}
RETVAL_OBJVAL(php_http_message_object_new_ex(obj->zo.ce, php_http_message_copy_ex(obj->message, NULL, 0), NULL TSRMLS_CC), 0);
RETVAL_OBJVAL(php_http_message_object_new_ex(php_http_message_class_entry, msg, NULL TSRMLS_CC), 0);
}
}
RETVAL_OBJVAL(php_http_message_object_new_ex(php_http_message_class_entry, msg, NULL TSRMLS_CC), 0);
}
}