static inline void _http_globals_init(zend_http_globals *G TSRMLS_DC)
{
G->send.buffer_size = HTTP_SENDBUF_SIZE;
- zend_hash_init(&G->request.methods.custom, 0, NULL, ZVAL_PTR_DTOR, 0);
}
#define http_globals_free(g) _http_globals_free((g) TSRMLS_CC)
{
STR_SET(G->send.content_type, NULL);
STR_SET(G->send.unquoted_etag, NULL);
- zend_hash_destroy(&G->request.methods.custom);
}
/* }}} */
http_globals_init(HTTP_GLOBALS);
+ if ( (SUCCESS != PHP_RINIT_CALL(http_request_method))
#ifdef HTTP_HAVE_ZLIB
- if (SUCCESS != PHP_RINIT_CALL(http_encoding)) {
+ || (SUCCESS != PHP_RINIT_CALL(http_encoding))
+#endif
+ ) {
return FAILURE;
}
-#endif
return SUCCESS;
}
{
STATUS status = SUCCESS;
- if (
+ if ( (SUCCESS != PHP_RSHUTDOWN_CALL(http_request_method))
#ifdef HTTP_HAVE_ZLIB
- (SUCCESS != PHP_RSHUTDOWN_CALL(http_encoding)) ||
-#endif
-#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL)
- (SUCCESS != PHP_RSHUTDOWN_CALL(http_request_method)) ||
+ || (SUCCESS != PHP_RSHUTDOWN_CALL(http_encoding))
#endif
- 0) {
+ ) {
status = FAILURE;
}
php_info_print_table_start();
php_info_print_table_colspan_header(2, "Request Methods");
{
- unsigned i;
- HashPosition pos;
- zval **custom_method;
+ int i;
+ getGlobals(G);
+ struct _entry {char *name; char *cnst;} *entry;
phpstr *known_request_methods = phpstr_new();
phpstr *custom_request_methods = phpstr_new();
- for (i = HTTP_NO_REQUEST_METHOD+1; i < HTTP_MAX_REQUEST_METHOD; ++i) {
+ for (i = HTTP_MIN_REQUEST_METHOD; i < HTTP_MAX_REQUEST_METHOD; ++i) {
phpstr_appendl(known_request_methods, http_request_method_name(i));
phpstr_appends(known_request_methods, ", ");
}
- FOREACH_HASH_VAL(pos, &HTTP_G(request).methods.custom, custom_method) {
- phpstr_append(custom_request_methods, Z_STRVAL_PP(custom_method), Z_STRLEN_PP(custom_method));
- phpstr_appends(custom_request_methods, ", ");
+ for (i = 0; i < G->request.methods.custom.count; ++i) {
+ if ((entry = ((struct _entry **) G->request.methods.custom.entries)[i])) {
+ phpstr_appendf(custom_request_methods, "%s, ", entry->name);
+ }
}
phpstr_append(known_request_methods, PHPSTR_VAL(custom_request_methods), PHPSTR_LEN(custom_request_methods));
if (is_numeric_string(Z_STRVAL_P(method), Z_STRLEN_P(method), NULL, NULL, 1)) {
convert_to_long(method);
} else {
- ulong mn;
+ int mn;
if (!(mn = http_request_method_exists(1, 0, Z_STRVAL_P(method)))) {
RETURN_FALSE;
}
RETURN_LONG((long) http_request_method_exists(1, 0, Z_STRVAL_P(method)));
}
case IS_LONG:
- RETURN_LONG((long) http_request_method_exists(0, Z_LVAL_P(method), NULL));
+ RETURN_LONG((long) http_request_method_exists(0, (int) Z_LVAL_P(method), NULL));
default:
RETURN_FALSE;
}
RETURN_FALSE;
}
- RETURN_STRING(estrdup(http_request_method_name((ulong) method)), 0);
+ RETURN_STRING(estrdup(http_request_method_name((int) method)), 0);
}
}
/* }}} */
return SUCCESS;
}
+PHP_RINIT_FUNCTION(http_request_method)
+{
+ HTTP_G(request).methods.custom.entries = ecalloc(1, sizeof(http_request_method_entry *));
+
+ return SUCCESS;
+}
+
PHP_RSHUTDOWN_FUNCTION(http_request_method)
{
- int i, c = zend_hash_num_elements(&HTTP_G(request).methods.custom);
+ int i;
+ getGlobals(G);
+ http_request_method_entry **ptr = G->request.methods.custom.entries;
- for (i = 0; i < c; ++i) {
- http_request_method_unregister(HTTP_MAX_REQUEST_METHOD + i);
+ for (i = 0; i < G->request.methods.custom.count; ++i) {
+ if (ptr[i]) {
+ http_request_method_unregister(HTTP_CUSTOM_REQUEST_METHOD_START + i);
+ }
}
+ efree(G->request.methods.custom.entries);
return SUCCESS;
}
/* {{{ char *http_request_method_name(http_request_method) */
PHP_HTTP_API const char *_http_request_method_name(http_request_method m TSRMLS_DC)
{
- zval **meth;
+ getGlobals(G);
+ http_request_method_entry **ptr = G->request.methods.custom.entries;
if (HTTP_STD_REQUEST_METHOD(m)) {
return http_request_methods[m];
}
- if (SUCCESS == zend_hash_index_find(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(m), (void **) &meth)) {
- return Z_STRVAL_PP(meth);
+ if ( (HTTP_CUSTOM_REQUEST_METHOD(m) >= 0) &&
+ (HTTP_CUSTOM_REQUEST_METHOD(m) < G->request.methods.custom.count) &&
+ (ptr[HTTP_CUSTOM_REQUEST_METHOD(m)])) {
+ return ptr[HTTP_CUSTOM_REQUEST_METHOD(m)]->name;
}
return http_request_methods[0];
}
/* }}} */
-/* {{{ ulong http_request_method_exists(zend_bool, ulong, char *) */
-PHP_HTTP_API ulong _http_request_method_exists(zend_bool by_name, ulong id, const char *name TSRMLS_DC)
+/* {{{ int http_request_method_exists(zend_bool, ulong, char *) */
+PHP_HTTP_API int _http_request_method_exists(zend_bool by_name, http_request_method id, const char *name TSRMLS_DC)
{
+ int i;
+ getGlobals(G);
+ http_request_method_entry **ptr = G->request.methods.custom.entries;
+
if (by_name) {
- unsigned i;
-
- for (i = HTTP_NO_REQUEST_METHOD + 1; i < HTTP_MAX_REQUEST_METHOD; ++i) {
- if (!strcmp(name, http_request_methods[i])) {
+ for (i = HTTP_MIN_REQUEST_METHOD; i < HTTP_MAX_REQUEST_METHOD; ++i) {
+ if (!strcasecmp(name, http_request_methods[i])) {
return i;
}
}
- {
- zval **data;
- char *key;
- ulong idx;
- HashPosition pos;
-
- FOREACH_HASH_KEYVAL(pos, &HTTP_G(request).methods.custom, key, idx, data) {
- if (!strcmp(name, Z_STRVAL_PP(data))) {
- return idx + HTTP_MAX_REQUEST_METHOD;
- }
+ for (i = 0; i < G->request.methods.custom.count; ++i) {
+ if (ptr[i] && !strcasecmp(name, ptr[i]->name)) {
+ return HTTP_CUSTOM_REQUEST_METHOD_START + i;
}
}
- return 0;
- } else {
- return HTTP_STD_REQUEST_METHOD(id) || zend_hash_index_exists(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(id)) ? id : 0;
+ } else if (HTTP_STD_REQUEST_METHOD(id)) {
+ return id;
+ } else if ( (HTTP_CUSTOM_REQUEST_METHOD(id) >= 0) &&
+ (HTTP_CUSTOM_REQUEST_METHOD(id) < G->request.methods.custom.count) &&
+ (ptr[HTTP_CUSTOM_REQUEST_METHOD(id)])) {
+ return id;
}
+
+ return 0;
}
/* }}} */
-/* {{{ ulong http_request_method_register(char *) */
-PHP_HTTP_API ulong _http_request_method_register(const char *method_name, size_t method_name_len TSRMLS_DC)
+/* {{{ int http_request_method_register(char *) */
+PHP_HTTP_API int _http_request_method_register(const char *method_name, int method_name_len TSRMLS_DC)
{
- zval array;
- char *http_method, *method;
- ulong i, meth_num = HTTP_G(request).methods.custom.nNextFreeElement + HTTP_MAX_REQUEST_METHOD;
-
+ int i, meth_num;
+ char *http_method, *method, *mconst;
+ getGlobals(G);
+ http_request_method_entry **ptr = G->request.methods.custom.entries;
+
+ if (!isalpha(*method_name)) {
+ http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Request method does not start with a character (%s)", method_name);
+ return 0;
+ }
+
+ if (http_request_method_exists(1, 0, method_name)) {
+ http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Request method does already exist (%s)", method_name);
+ return 0;
+ }
+
method = emalloc(method_name_len + 1);
+ mconst = emalloc(method_name_len + 1);
for (i = 0; i < method_name_len; ++i) {
- method[i] = toupper(method_name[i]);
+ switch (method_name[i])
+ {
+ case '-':
+ method[i] = '-';
+ mconst[i] = '_';
+ break;
+
+ default:
+ if (!isalnum(method_name[i])) {
+ efree(method);
+ efree(mconst);
+ http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Request method contains illegal characters (%s)", method_name);
+ return 0;
+ }
+ mconst[i] = method[i] = toupper(method_name[i]);
+ break;
+ }
}
method[method_name_len] = '\0';
+ mconst[method_name_len] = '\0';
- INIT_ZARR(array, &HTTP_G(request).methods.custom);
- add_next_index_stringl(&array, method, method_name_len, 0);
+ ptr = erealloc(ptr, sizeof(http_request_method_entry *) * (G->request.methods.custom.count + 1));
+ G->request.methods.custom.entries = ptr;
+ ptr[G->request.methods.custom.count] = emalloc(sizeof(http_request_method_entry));
+ ptr[G->request.methods.custom.count]->name = method;
+ ptr[G->request.methods.custom.count]->cnst = mconst;
+ meth_num = HTTP_CUSTOM_REQUEST_METHOD_START + G->request.methods.custom.count++;
- method_name_len = spprintf(&http_method, 0, "HTTP_METH_%s", method);
+ method_name_len = spprintf(&http_method, 0, "HTTP_METH_%s", mconst);
zend_register_long_constant(http_method, method_name_len + 1, meth_num, CONST_CS, http_module_number TSRMLS_CC);
efree(http_method);
#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) && !defined(WONKY)
- method_name_len = spprintf(&http_method, 0, "METH_%s", method);
+ method_name_len = spprintf(&http_method, 0, "METH_%s", mconst);
zend_declare_class_constant_long(http_request_object_ce, http_method, method_name_len, meth_num TSRMLS_CC);
efree(http_method);
#endif
-
+
return meth_num;
}
/* }}} */
-/* {{{ STATUS http_request_method_unregister(usngigned long) */
-PHP_HTTP_API STATUS _http_request_method_unregister(ulong method TSRMLS_DC)
+/* {{{ STATUS http_request_method_unregister(int) */
+PHP_HTTP_API STATUS _http_request_method_unregister(int method TSRMLS_DC)
{
- zval **zmethod;
char *http_method;
int method_len;
-
- if (SUCCESS != zend_hash_index_find(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(method), (void **) &zmethod)) {
- http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Request method with id %lu does not exist", method);
+ getGlobals(G);
+ http_request_method_entry **ptr = G->request.methods.custom.entries;
+
+ if (HTTP_STD_REQUEST_METHOD(method)) {
+ http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Standard request methods cannot be unregistered");
return FAILURE;
}
+ if ( (HTTP_CUSTOM_REQUEST_METHOD(method) < 0) ||
+ (HTTP_CUSTOM_REQUEST_METHOD(method) > G->request.methods.custom.count) ||
+ (!ptr[HTTP_CUSTOM_REQUEST_METHOD(method)])) {
+ http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Custom request method with id %lu does not exist", method);
+ return FAILURE;
+ }
+
#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) && !defined(WONKY)
- method_len = spprintf(&http_method, 0, "METH_%s", Z_STRVAL_PP(zmethod));
- if ((SUCCESS != zend_hash_del(&http_request_object_ce->constants_table, http_method, method_len + 1))) {
+ method_len = spprintf(&http_method, 0, "METH_%s", ptr[HTTP_CUSTOM_REQUEST_METHOD(method)]->cnst);
+ if (SUCCESS != zend_hash_del(&http_request_object_ce->constants_table, http_method, method_len + 1)) {
http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Could not unregister request method: HttpRequest::%s", http_method);
efree(http_method);
return FAILURE;
efree(http_method);
#endif
- method_len = spprintf(&http_method, 0, "HTTP_METH_%s", Z_STRVAL_PP(zmethod));
- if ( (SUCCESS != zend_hash_index_del(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(method)))
- || (SUCCESS != zend_hash_del(EG(zend_constants), http_method, method_len + 1))) {
+ method_len = spprintf(&http_method, 0, "HTTP_METH_%s", ptr[HTTP_CUSTOM_REQUEST_METHOD(method)]->cnst);
+ if (SUCCESS != zend_hash_del(EG(zend_constants), http_method, method_len + 1)) {
http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Could not unregister request method: %s", http_method);
efree(http_method);
return FAILURE;
}
efree(http_method);
+ efree(ptr[HTTP_CUSTOM_REQUEST_METHOD(method)]->name);
+ efree(ptr[HTTP_CUSTOM_REQUEST_METHOD(method)]->cnst);
+ STR_SET(ptr[HTTP_CUSTOM_REQUEST_METHOD(method)], NULL);
+
return SUCCESS;
}
/* }}} */
support. Parallel requests are available for PHP-5 and greater.
PHP-5 classes:
-HttpUtil, HttpMessage, HttpRequest, HttpRequestPool; HttpResponse (PHP-5.1)
+HttpUtil, HttpMessage, HttpRequest, HttpRequestPool,
+HttpDeflateStream, HttpInflateStream
+
+PHP-5.1 classes:
+HttpResponse
</description>
<maintainers>
<maintainer>
</maintainer>
</maintainers>
<release>
- <version>0.20.0</version>
- <date>2005-12-15</date>
+ <version>0.21.0</version>
+ <date>2005-12-27</date>
<license>BSD, revised</license>
<state>beta</state>
- <notes>! Request functionality requires libcurl >= 7.12.3 now
+ <notes>! Encodings functionality requires libz version 1.2.0.4 or greater
-+ Added 'bodyonly' request option
-+ Added IOCTL callback for cURL
-+ Added ssl_engines array and cookies array to the request info array
-+ Added http_parse_cookie() to parse Set-Cookie headers
++ Added HttpDeflateStream and HttpInflateStream classes
++ Added ob_deflatehandler and ob_inflatehandler
-- Renamed http_connectcode to connect_code in the request info array
-- Enable "original headers" previously stripped off by the message parser:
- o X-Original-Transfer-Encoding (Transfer-Encoding)
- o X-Original-Content-Encoding (Content-Encoding)
- o X-Original-Content-Length (Content-Length)
-- RequestExceptions thrown by HttpRequestPool::__construct() and send() are
- now wrapped into the HttpRequestPoolException object's $exceptionStack property
-- Removed http_compress() and http_uncompress() (http_deflate/inflate ambiguity)
+- Changed HttpRequest properties to be private
-* Fixed bug which caused GZIP encoded archives to be decoded
-* Fixed bug with DEFLATE encoded response messages
-* Fixed several memory leaks and inconspicuous access violations
-* Fixed some logical errors in the uri builder
+* Fixed a lot of memory corruptions within HttpRequest
</notes>
<deps>
<dep type="php" rel="ge" version="4.3"/>
<file role="src" name="phpstr.h"/>
</dir> <!-- /phpstr -->
<dir name="tests">
- <file role="test" name="abs_uri_001.phpt"/>
- <file role="test" name="abs_uri_002.phpt"/>
<file role="test" name="allowed_methods_001.phpt"/>
<file role="test" name="allowed_methods_001_logging.phpt"/>
<file role="test" name="allowed_methods_002.phpt"/>
<file role="test" name="allowed_methods_002_logging.phpt"/>
- <file role="test" name="build_uri_001.phpt"/>
+ <file role="test" name="build_url_001.phpt"/>
+ <file role="test" name="build_url_002.phpt"/>
+ <file role="test" name="build_url_003.phpt"/>
<file role="test" name="chunked_decode_001.phpt"/>
<file role="test" name="chunked_decode_002.phpt"/>
<file role="test" name="chunked_decode_003.phpt"/>
<file role="test" name="date_001.phpt"/>
<file role="test" name="date_002.phpt"/>
<file role="test" name="encodings.phpt"/>
+ <file role="test" name="encoding_objects_001.phpt"/>
<file role="test" name="etag_mode_001.phpt"/>
<file role="test" name="etag_mode_002.phpt"/>
<file role="test" name="etag_mode_003.phpt"/>
<file role="test" name="HttpRequestPool_002.phpt"/>
<file role="test" name="HttpRequestPool_003.phpt"/>
<file role="test" name="HttpRequestPool_004.phpt"/>
+ <file role="test" name="HttpRequestPool_005.phpt"/>
<file role="test" name="HttpRequest_001.phpt"/>
<file role="test" name="HttpRequest_002.phpt"/>
<file role="test" name="HttpRequest_003.phpt"/>
+ <file role="test" name="HttpRequest_004.phpt"/>
<file role="test" name="HttpResponse_001.phpt"/>
<file role="test" name="HttpResponse_002.phpt"/>
<file role="test" name="HttpResponse_003.phpt"/>
<file role="src" name="http_api.c"/>
<file role="src" name="http_cache_api.c"/>
<file role="src" name="http_date_api.c"/>
+ <file role="src" name="http_deflatestream_object.c"/>
<file role="src" name="http_encoding_api.c"/>
<file role="src" name="http_exception_object.c"/>
<file role="src" name="http_filter_api.c"/>
<file role="src" name="http_functions.c"/>
<file role="src" name="http_headers_api.c"/>
+ <file role="src" name="http_inflatestream_object.c"/>
<file role="src" name="http_info_api.c"/>
<file role="src" name="http_message_api.c"/>
<file role="src" name="http_message_object.c"/>
<file role="src" name="php_http_api.h"/>
<file role="src" name="php_http_cache_api.h"/>
<file role="src" name="php_http_date_api.h"/>
+ <file role="src" name="php_http_deflatestream_object.h"/>
<file role="src" name="php_http_encoding_api.h"/>
<file role="src" name="php_http_exception_object.h"/>
<file role="src" name="php_http_filter_api.h"/>
<file role="src" name="php_http_headers_api.h"/>
+ <file role="src" name="php_http_inflatestream_object.h"/>
<file role="src" name="php_http_info_api.h"/>
<file role="src" name="php_http_message_api.h"/>
<file role="src" name="php_http_message_object.h"/>
struct _http_globals_request {
struct _http_globals_request_methods {
char *allowed;
- HashTable custom;
+ struct {
+ int count;
+ void *entries;
+ } custom;
} methods;
} request;
# define HTTP_G(v) (http_globals.v)
# define HTTP_GLOBALS (&http_globals)
#endif
-#define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS;
+#define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS
PHP_FUNCTION(http_test);
PHP_FUNCTION(http_date);
HTTP_MAX_REQUEST_METHOD = 28
} http_request_method;
+#define HTTP_MIN_REQUEST_METHOD (HTTP_NO_REQUEST_METHOD + 1)
+#define HTTP_CUSTOM_REQUEST_METHOD_START HTTP_MAX_REQUEST_METHOD
+
+typedef struct {
+ char *name;
+ char *cnst;
+} http_request_method_entry;
+
#define HTTP_STD_REQUEST_METHOD(m) ((m > HTTP_NO_REQUEST_METHOD) && (m < HTTP_MAX_REQUEST_METHOD))
#define HTTP_CUSTOM_REQUEST_METHOD(m) (m - HTTP_MAX_REQUEST_METHOD)
extern PHP_MINIT_FUNCTION(http_request_method);
+extern PHP_RINIT_FUNCTION(http_request_method);
extern PHP_RSHUTDOWN_FUNCTION(http_request_method);
#define http_request_method_name(m) _http_request_method_name((m) TSRMLS_CC)
PHP_HTTP_API const char *_http_request_method_name(http_request_method m TSRMLS_DC);
#define http_request_method_exists(u, l, c) _http_request_method_exists((u), (l), (c) TSRMLS_CC)
-PHP_HTTP_API ulong _http_request_method_exists(zend_bool by_name, ulong id, const char *name TSRMLS_DC);
+PHP_HTTP_API int _http_request_method_exists(zend_bool by_name, http_request_method id, const char *name TSRMLS_DC);
#define http_request_method_register(m, l) _http_request_method_register((m), (l) TSRMLS_CC)
-PHP_HTTP_API ulong _http_request_method_register(const char *method, size_t method_name_len TSRMLS_DC);
+PHP_HTTP_API int _http_request_method_register(const char *method, int method_name_len TSRMLS_DC);
#define http_request_method_unregister(mn) _http_request_method_unregister((mn) TSRMLS_CC)
-PHP_HTTP_API STATUS _http_request_method_unregister(ulong method TSRMLS_DC);
+PHP_HTTP_API STATUS _http_request_method_unregister(int method TSRMLS_DC);
#endif
%sTEST
First Request
-string(150) "Array
+string(149) "Array
(
[int] => 1
[dbl] => 3.1415926535898
[nil] =>
)
string(44) "int=1&dbl=3.1415926535898&str=something&nil="
-
"
array(2) {
[0]=>
}
Second Request
-string(270) "Array
+string(269) "Array
(
[0] => Array
(
)
string(56) "0[int]=1&0[dbl]=3.1415926535898&1[str]=something&1[nil]="
-
"
array(2) {
[0]=>
}
Third Request
-string(287) "Array
+string(286) "Array
(
[0] => Array
(
[x] => X
)
string(60) "0[int]=1&0[dbl]=3.1415926535898&1[str]=something&1[nil]=&x=X"
-
"
array(2) {
[0]=>
}
Fourth Request
-string(14) "string(0) ""
-
+string(13) "string(0) ""
"
array(2) {
[0]=>
%s
}
["body:protected"]=>
- string(310) "string(294) "<?xml version="1.0" encoding="iso-8859-1"?>
+ string(309) "string(294) "<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>testMethod</methodName>
<params>
</params>
</methodCall>
"
-
"
}
object(HttpMessage)#%d (%d) {
%s
}
["body:protected"]=>
- string(310) "string(294) "<?xml version="1.0" encoding="iso-8859-1"?>
+ string(309) "string(294) "<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>testMethod</methodName>
<params>
</params>
</methodCall>
"
-
"
}
object(HttpMessage)#%d (%d) {
%s
}
["body:protected"]=>
- string(310) "string(294) "<?xml version="1.0" encoding="iso-8859-1"?>
+ string(309) "string(294) "<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>testMethod</methodName>
<params>
</params>
</methodCall>
"
-
"
}
Done
--- /dev/null
+--TEST--
+HttpRequest custom request method
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcls('HttpRequest');
+?>
+--FILE--
+<?php
+echo "-TEST\n";
+
+HttpRequest::methodRegister('foobar');
+$r = new HttpRequest('http://dev.iworks.at/.print_request.php', HttpRequest::METH_FOOBAR);
+$r->setContentType('text/plain');
+$r->setRawPostData('Yep, this is FOOBAR!');
+var_dump($r->send()->getResponseCode());
+var_dump($r->getRawRequestMessage());
+
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+int(200)
+string(189) "FOOBAR /.print_request.php HTTP/1.1
+User-Agent: %s
+Host: dev.iworks.at
+Accept: */*
+Content-Type: text/plain
+Content-Length: 20
+
+Yep, this is FOOBAR!"
+Done
["Vary"]=>
string(15) "Accept-Encoding"
["Content-Length"]=>
- string(2) "27"
+ string(2) "26"
["Content-Type"]=>
string(9) "text/html"
["X-Original-Content-Encoding"]=>
string(4) "gzip"
["X-Original-Content-Length"]=>
- string(2) "52"
+ string(2) "51"
}
["body"]=>
- string(27) "Array
+ string(26) "Array
(
[gzip] => 1
)
-
"
["parentMessage"]=>
NULL
}
echo "Done\n";
+?>
--EXPECTF--
%sTEST
int(0)