- add first version of package2.xml
authorMichael Wallner <mike@php.net>
Thu, 22 Sep 2005 11:48:22 +0000 (11:48 +0000)
committerMichael Wallner <mike@php.net>
Thu, 22 Sep 2005 11:48:22 +0000 (11:48 +0000)
- define PHPSTR_DEFAULT_SIZE in the header
- some minor tidbits

http_request_api.c
http_response_object.c
missing.c
package2.xml [new file with mode: 0644]
phpstr/phpstr.c
phpstr/phpstr.h

index 8b195f80a644647d6e3f0048f0a538208628a385..d9b1a2198a06067823881907a09bbad592407856 100644 (file)
@@ -275,12 +275,14 @@ PHP_HTTP_API STATUS _http_request_body_fill(http_request_body *body, HashTable *
 
                /* file data */
                FOREACH_HASH_VAL(files, data) {
-                       CURLcode err;
                        zval **file, **type, **name;
-                       if (    SUCCESS == zend_hash_find(Z_ARRVAL_PP(data), "name", sizeof("name"), (void **) &name) &&
-                                       SUCCESS == zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &type) &&
-                                       SUCCESS == zend_hash_find(Z_ARRVAL_PP(data), "file", sizeof("file"), (void **) &file)) {
-                               err = curl_formadd(&http_post_data[0], &http_post_data[1],
+                       
+                       if (    SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "name", sizeof("name"), (void **) &name) ||
+                                       SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &type) ||
+                                       SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "file", sizeof("file"), (void **) &file)) {
+                               http_error(HE_NOTICE, HTTP_E_INVALID_PARAM, "Post file array entry misses either 'name', 'type' or 'file' entry");
+                       } else {
+                               CURLcode err = curl_formadd(&http_post_data[0], &http_post_data[1],
                                        CURLFORM_COPYNAME,              Z_STRVAL_PP(name),
                                        CURLFORM_FILE,                  Z_STRVAL_PP(file),
                                        CURLFORM_CONTENTTYPE,   Z_STRVAL_PP(type),
@@ -291,8 +293,6 @@ PHP_HTTP_API STATUS _http_request_body_fill(http_request_body *body, HashTable *
                                        curl_formfree(http_post_data[0]);
                                        return FAILURE;
                                }
-                       } else {
-                               http_error(HE_NOTICE, HTTP_E_INVALID_PARAM, "Post file array entry misses either 'name', 'type' or 'file' entry");
                        }
                }
 
index c0c66af090543aee016a5822866e0a04adee15c4..23071983c12b3c8e6f36413d33a004030196dc2e 100644 (file)
@@ -545,6 +545,8 @@ PHP_METHOD(HttpResponse, guessContentType)
                }
        }
        SET_EH_NORMAL();
+#else
+       http_error(HE_THROW, HTTP_E_RUNTIME, "Cannot guess Content-Type; libmagic not available");
 #endif
 }
 /* }}} */
index 9d9b9412cf8ad31bd54251e10c9b969bb324b454..584a75c4c137492eff307429a0770edc562217cb 100644 (file)
--- a/missing.c
+++ b/missing.c
@@ -43,7 +43,8 @@ int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length
 }
 
 void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC)
-{      zval *tmp = ecalloc(1, sizeof(zval));
+{
+       zval *tmp = ecalloc(1, sizeof(zval));
        ZVAL_BOOL(tmp, value);
        zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
 }
diff --git a/package2.xml b/package2.xml
new file mode 100644 (file)
index 0000000..9972ba9
--- /dev/null
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+  http://pear.php.net/dtd/tasks-1.0
+  http://pear.php.net/dtd/tasks-1.0.xsd
+  http://pear.php.net/dtd/package-2.0
+  http://pear.php.net/dtd/package-2.0.xsd">
+ <name>http</name>
+ <channel>pecl.php.net</channel>
+ <summary>Extended HTTP Support</summary>
+ <description><![CDATA[
+* Building absolute URIs
+* RFC compliant HTTP redirects
+* RFC compliant HTTP date handling
+* Parsing of HTTP headers and messages
+* Caching by "Last-Modified" and/or ETag
+  (with 'on the fly' option for ETag generation from buffered output)
+* Sending data/files/streams with (multiple) ranges support
+* Negotiating user preferred language/charset
+* Convenient request functionality built upon libcurl
+* PHP5 classes: HttpUtil, HttpResponse (PHP-5.1), HttpRequest, HttpRequestPool, HttpMessage
+]]></description>
+ <lead>
+  <name>Michael Wallner</name>
+  <user>mike</user>
+  <email>mike@php.net</email>
+  <active>yes</active>
+ </lead>
+ <date>2005-00-00</date>
+ <version>
+  <release>0.14.0dev</release>
+  <api>0.14.0</api>
+ </version>
+ <stability>
+  <release>beta</release>
+  <api>beta</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes><![CDATA[
++ Added missing support for raw post data in HttpRequest
++ Added missing HttpMessage::setBody()
+]]></notes>
+ <contents>
+  <dir name="/">
+   <file role="doc" name="CREDITS"/>
+   <file role="doc" name="EXPERIMENTAL"/>
+   <file role="doc" name="KnownIssues.txt"/>
+   <file role="doc" name="docs/functions.html"/>
+   <file role="doc" name="docs/examples/Bandwidth_Throttling.php"/>
+   <file role="doc" name="docs/examples/Cached_Responses.php"/>
+   <file role="doc" name="docs/examples/GET_Queries.php"/>
+   <file role="doc" name="docs/examples/KISS_XMLRPC_Client.php"/>
+   <file role="doc" name="docs/examples/Multipart_Posts.php"/>
+   <file role="doc" name="docs/examples/Parallel_Requests.php"/>
+   <file role="doc" name="docs/examples/Parallel_Requests_.php"/>
+   <file role="doc" name="docs/examples/Simple_Feed_Aggregator.php"/>
+   <file role="doc" name="docs/examples/extract.php"/>
+   <file role="doc" name="docs/examples/tutorial.txt"/>
+   
+   <file role="src" name="http.dsp"/>
+   <file role="src" name="config.w32"/>
+   <file role="src" name="config.m4"/>
+   <file role="src" name="Makefile.frag"/>
+   
+   <dir name="phpstr">
+    <file role="src" name="phpstr.h"/>
+    <file role="src" name="phpstr.c"/>
+   </dir>
+   
+   <file role="src" name="missing.h"/>
+   <file role="src" name="missing.c"/>
+   
+   <file role="src" name="php_http.h"/>
+   <file role="src" name="php_http_std_defs.h"/>
+   <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_headers_api.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_request_api.h"/>
+   <file role="src" name="php_http_request_method_api.h"/>
+   <file role="src" name="php_http_request_pool_api.h"/>
+   <file role="src" name="php_http_send_api.h"/>
+   <file role="src" name="php_http_url_api.h"/>
+   <file role="src" name="php_http_util_object.h"/>
+   <file role="src" name="php_http_message_object.h"/>
+   <file role="src" name="php_http_request_object.h"/>
+   <file role="src" name="php_http_requestpool_object.h"/>
+   <file role="src" name="php_http_response_object.h"/>
+   <file role="src" name="php_http_exception_object.h"/>
+   
+   <file role="src" name="http.c"/>
+   <file role="src" name="http_functions.c"/>
+   <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_headers_api.c"/>
+   <file role="src" name="http_info_api.c"/>
+   <file role="src" name="http_message_api.c"/>
+   <file role="src" name="http_request_api.c"/>
+   <file role="src" name="http_request_method_api.c"/>
+   <file role="src" name="http_request_pool_api.c"/>
+   <file role="src" name="http_send_api.c"/>
+   <file role="src" name="http_url_api.c"/>
+   <file role="src" name="http_util_object.c"/>
+   <file role="src" name="http_message_object.c"/>
+   <file role="src" name="http_request_object.c"/>
+   <file role="src" name="http_requestpool_object.c"/>
+   <file role="src" name="http_response_object.c"/>
+   <file role="src" name="http_exception_object.c"/>
+   
+   <dir name="tests">
+    <file role="test" name="data.txt"/>
+    <file role="test" name="skip.inc"/>
+    <file role="test" name="log.inc"/>
+    <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="chunked_decode_001.phpt"/>
+    <file role="test" name="chunked_decode_002.phpt"/>
+    <file role="test" name="date_001.phpt"/>
+    <file role="test" name="date_002.phpt"/>
+    <file role="test" name="get_request_data_001.phpt"/>
+    <file role="test" name="HttpMessage_001.phpt"/>
+    <file role="test" name="HttpRequestPool_001.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="HttpResponse_001.phpt"/>
+    <file role="test" name="HttpResponse_002.phpt"/>
+    <file role="test" name="INI_001.phpt"/>
+    <file role="test" name="parse_headers_001.phpt"/>
+    <file role="test" name="parse_message_001.phpt"/>
+    <file role="test" name="redirect_001.phpt"/>
+    <file role="test" name="redirect_001_logging.phpt"/>
+    <file role="test" name="redirect_002.phpt"/>
+    <file role="test" name="redirect_002_logging.phpt"/>
+    <file role="test" name="redirect_003.phpt"/>
+    <file role="test" name="redirect_003_logging.phpt"/>
+    <file role="test" name="send_data_001.phpt"/>
+    <file role="test" name="send_data_002.phpt"/>
+    <file role="test" name="send_data_003.phpt"/>
+    <file role="test" name="send_data_004.phpt"/>
+    <file role="test" name="send_data_005.phpt"/>
+    <file role="test" name="send_data_006.phpt"/>
+    <file role="test" name="send_data_007_logging.phpt"/>
+    <file role="test" name="send_data_008.phpt"/>
+    <file role="test" name="send_data_009.phpt"/>
+    <file role="test" name="send_file_001.phpt"/>
+    <file role="test" name="send_file_002.phpt"/>
+    <file role="test" name="send_file_003.phpt"/>
+    <file role="test" name="send_file_004.phpt"/>
+    <file role="test" name="send_file_005.phpt"/>
+    <file role="test" name="send_file_006.phpt"/>
+    <file role="test" name="send_file_007.phpt"/>
+   </dir>
+  </dir>
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>4.3</min>
+    <max>6.0.0</max>
+    <exclude>6.0.0</exclude>
+   </php>
+   <pearinstaller>
+    <min>1.4.0</min>
+   </pearinstaller>
+  </required>
+  <optional>
+   <extension>
+    <name>session</name>
+   </extension>
+  </optional>
+ </dependencies>
+ <providesextension>http</providesextension>
+ <extsrcrelease>
+  <configureoption 
+   name="with-http-curl-requests"
+   prompt="wheter to enable cURL HTTP requests"
+   default="yes"
+  />
+  <configureoption
+   name="with-http-mhash-etags"
+   prompt="whether to enable mhash ETag generator"
+   default="yes"
+  />
+  <configureoption
+   name="with-http-magic-mime"
+   prompt="whether to enable response content type guessing"
+   default="no"
+  />
+  <!--
+  <filelist>
+   <install as="functions.html" name="docs/functions.html"/>
+   <install as="examples/Bandwidth_Throttling.php" name="docs/examples/Bandwidth_Throttling.php"/>
+   <install as="examples/Cached_Responses.php" name="docs/examples/Cached_Responses.php"/>
+   <install as="examples/GET_Queries.php" name="docs/examples/GET_Queries.php"/>
+   <install as="examples/KISS_XMLRPC_Client.php" name="docs/examples/KISS_XMLRPC_Client.php"/>
+   <install as="examples/Multipart_Posts.php" name="docs/examples/Multipart_Posts.php"/>
+   <install as="examples/Parallel_Requests.php" name="docs/examples/Parallel_Requests.php"/>
+   <install as="examples/Parallel_Requests_.php" name="docs/examples/Parallel_Requests_.php"/>
+   <install as="examples/Simple_Feed_Aggregator.php" name="docs/examples/Simple_Feed_Aggregator.php"/>
+   <install as="examples/extract.php" name="docs/examples/extract.php"/>
+   <install as="examples/tutorial.txt" name="docs/examples/tutorial.txt"/>
+  </filelist>
+  -->
+ </extsrcrelease>
+ <changelog />
+</package>
\ No newline at end of file
index acee06fde4df9f39197b3302a79c1811d307f4c5..70673a92ed7c4fd4c8b5f737b75442b98a4d73c9 100644 (file)
@@ -4,10 +4,6 @@
 #include "php.h"
 #include "phpstr.h"
 
-#ifndef PHPSTR_DEFAULT_SIZE
-#define PHPSTR_DEFAULT_SIZE 256
-#endif
-
 PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size, zend_bool pre_alloc)
 {
        if (!buf) {
index a36f88ac2d25aab2dfaa6bf0c37ed33edd6366f4..5b2ee5664a09c75ee7cec172e5ed5adfc01bdb91 100644 (file)
@@ -6,6 +6,10 @@
 
 #include "php.h"
 
+#ifndef PHPSTR_DEFAULT_SIZE
+#      define PHPSTR_DEFAULT_SIZE 256
+#endif
+
 #ifndef STR_SET
 #      define STR_SET(STR, SET) \
        { \