svn: /pecl/http/branches/DEV_2/ php_http_message.c php_http_message_body.c

From: Date: Thu, 14 Nov 2013 17:14:09 +0000
Subject: svn: /pecl/http/branches/DEV_2/ php_http_message.c php_http_message_body.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-19984@lists.php.net to get a copy of this message
mike Thu, 14 Nov 2013 17:14:09 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=332115 Log: arginfos, return values Changed paths: U pecl/http/branches/DEV_2/php_http_message.c U pecl/http/branches/DEV_2/php_http_message_body.c Modified: pecl/http/branches/DEV_2/php_http_message.c =================================================================== --- pecl/http/branches/DEV_2/php_http_message.c 2013-11-13 22:56:45 UTC (rev 332114) +++ pecl/http/branches/DEV_2/php_http_message.c 2013-11-14 17:14:09 UTC (rev 332115) @@ -1054,7 +1054,7 @@ } 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) { @@ -1070,7 +1070,7 @@ } 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) { @@ -1172,7 +1172,7 @@ } 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) { @@ -1222,7 +1222,7 @@ } 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) @@ -1293,7 +1293,6 @@ Z_TYPE_P(return_value) = IS_STRING; return; } - RETURN_FALSE; } ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setInfo, 0, 0, 1) @@ -1305,14 +1304,17 @@ 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); } @@ -1331,8 +1333,6 @@ 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) @@ -1368,7 +1368,6 @@ 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) @@ -1412,8 +1411,6 @@ RETURN_EMPTY_STRING(); } } - - RETURN_FALSE; } ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setResponseStatus, 0, 0, 1) @@ -1451,8 +1448,6 @@ RETURN_EMPTY_STRING(); } } - - RETURN_FALSE; } ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setRequestMethod, 0, 0, 1) @@ -1495,8 +1490,6 @@ RETURN_EMPTY_STRING(); } } - - RETURN_FALSE; } ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setRequestUrl, 0, 0, 1) @@ -1607,9 +1600,8 @@ 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) @@ -1671,6 +1663,7 @@ 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) { @@ -1683,11 +1676,8 @@ php_http_message_object_t *prepend_obj = zend_object_store_get_object(prepend TSRMLS_CC); PHP_HTTP_MESSAGE_OBJECT_INIT(obj); + PHP_HTTP_MESSAGE_OBJECT_INIT(prepend_obj); - if (!prepend_obj->message) { - prepend_obj->message = php_http_message_init(NULL, 0, NULL TSRMLS_CC); - } - /* safety check */ for (msg[0] = obj->message; msg[0]; msg[0] = msg[0]->parent) { for (msg[1] = prepend_obj->message; msg[1]; msg[1] = msg[1]->parent) { Modified: pecl/http/branches/DEV_2/php_http_message_body.c =================================================================== --- pecl/http/branches/DEV_2/php_http_message_body.c 2013-11-13 22:56:45 UTC (rev 332114) +++ pecl/http/branches/DEV_2/php_http_message_body.c 2013-11-14 17:14:09 UTC (rev 332115) @@ -724,6 +724,21 @@ } } +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(); @@ -855,6 +870,7 @@ 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)

« previous php.pecl.cvs (#19984) next »