}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setBody, 0, 0, 1)
- ZEND_ARG_INFO(0, body)
+ ZEND_ARG_OBJ_INFO(0, body, http\\Message\\Body, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, setBody)
{
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addBody, 0, 0, 1)
- ZEND_ARG_INFO(0, body)
+ ZEND_ARG_OBJ_INFO(0, body, http\\Message\\Body, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, addBody)
{
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeaders, 0, 0, 1)
- ZEND_ARG_INFO(0, headers)
+ ZEND_ARG_ARRAY_INFO(0, headers, 1)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, setHeaders)
{
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeaders, 0, 0, 1)
- ZEND_ARG_INFO(0, headers)
+ ZEND_ARG_ARRAY_INFO(0, headers, 0)
ZEND_ARG_INFO(0, append)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, addHeaders)
Z_TYPE_P(return_value) = IS_STRING;
return;
}
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setInfo, 0, 0, 1)
int len;
php_http_info_t inf;
- if ( SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len)
- && php_http_info_parse(&inf, str TSRMLS_CC)) {
+ if ( SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len)) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
- php_http_message_set_info(obj->message, &inf);
- php_http_info_dtor(&inf);
+ if (php_http_info_parse(&inf, str TSRMLS_CC)) {
+ php_http_message_set_info(obj->message, &inf);
+ php_http_info_dtor(&inf);
+ } else {
+ php_http_error(HE_WARNING, PHP_HTTP_E_MALFORMED_HEADERS, "Could not parse message info '%s'", str);
+ }
}
RETVAL_ZVAL(getThis(), 1, 0);
}
php_http_version_to_string(&obj->message->http.version, &str, &len, NULL, NULL TSRMLS_CC);
RETURN_STRINGL(str, len, 0);
}
-
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHttpVersion, 0, 0, 1)
PHP_HTTP_MESSAGE_TYPE_CHECK(RESPONSE, obj->message, RETURN_FALSE);
RETURN_LONG(obj->message->http.info.response.code);
}
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setResponseCode, 0, 0, 1)
RETURN_EMPTY_STRING();
}
}
-
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setResponseStatus, 0, 0, 1)
RETURN_EMPTY_STRING();
}
}
-
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setRequestMethod, 0, 0, 1)
RETURN_EMPTY_STRING();
}
}
-
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setRequestUrl, 0, 0, 1)
zend_fcall_info_args_clear(&fcd.fci, 1);
zval_ptr_dtor(&fcd.fcz);
- RETURN_TRUE;
+ RETURN_ZVAL(getThis(), 1, 0);
}
- RETURN_FALSE;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_serialize, 0, 0, 0)
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_prepend, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, message, http\\Message, 0)
+ ZEND_ARG_INFO(0, top)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, prepend)
{
php_http_message_object_t *prepend_obj = zend_object_store_get_object(prepend TSRMLS_CC);
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
-
- if (!prepend_obj->message) {
- prepend_obj->message = php_http_message_init(NULL, 0, NULL TSRMLS_CC);
- }
+ PHP_HTTP_MESSAGE_OBJECT_INIT(prepend_obj);
/* safety check */
for (msg[0] = obj->message; msg[0]; msg[0] = msg[0]->parent) {
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_getBoundary, 0, 0, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpMessageBody, getBoundary)
+{
+ if (SUCCESS == zend_parse_parameters_none()) {
+ php_http_message_body_object_t * obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
+
+ if (obj->body->boundary) {
+ RETURN_STRING(obj->body->boundary, 1);
+ }
+ }
+}
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_append, 0, 0, 1)
ZEND_ARG_INFO(0, string)
ZEND_END_ARG_INFO();
PHP_ME(HttpMessageBody, toStream, ai_HttpMessageBody_toStream, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, toCallback, ai_HttpMessageBody_toCallback, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, getResource, ai_HttpMessageBody_getResource, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, getBoundary, ai_HttpMessageBody_getBoundary, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, append, ai_HttpMessageBody_append, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, addForm, ai_HttpMessageBody_addForm, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, addPart, ai_HttpMessageBody_addPart, ZEND_ACC_PUBLIC)