- flush version
[m6w6/ext-http] / http_functions.c
index 4b611e037d964ee7122aaa970de514073b5418c9..fa9cf9ca6a947e4b33df73adbf0d9349dda576ae 100644 (file)
@@ -416,7 +416,7 @@ PHP_FUNCTION(ob_etaghandler)
  * Use with http_send() API.
  *
  * Example:
- * <code>
+ * <pre>
  * <?php
  * // ~ 20 kbyte/s
  * # http_throttle(1, 20000);
@@ -424,7 +424,7 @@ PHP_FUNCTION(ob_etaghandler)
  * # http_throttle(0.1, 2000);
  * http_send_file('document.pdf');
  * ?>
- * </code>
+ * </pre>
  */
 PHP_FUNCTION(http_throttle)
 {
@@ -652,6 +652,7 @@ PHP_FUNCTION(http_parse_headers)
 
 /* {{{ proto array http_get_request_headers(void)
  *
+ * Get a list of incoming HTTP headers.
  */
 PHP_FUNCTION(http_get_request_headers)
 {
@@ -662,6 +663,24 @@ PHP_FUNCTION(http_get_request_headers)
 }
 /* }}} */
 
+/* {{{ proto bool http_match_request_header(string header, string value[, bool match_case = false])
+ *
+ * Match an incoming HTTP header.
+ */
+PHP_FUNCTION(http_match_request_header)
+{
+       char *header, *value;
+       int header_len, value_len;
+       zend_bool match_case = 0, result = 0;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &header, &header_len, &value, &value_len, &match_case)) {
+               RETURN_FALSE;
+       }
+
+       RETURN_BOOL(http_match_request_header_ex(header, value, match_case));
+}
+/* }}} */
+
 /* {{{ HAVE_CURL */
 #ifdef HTTP_HAVE_CURL
 
@@ -825,7 +844,6 @@ PHP_FUNCTION(http_post_data)
        } else {
                RETVAL_FALSE;
        }
-       http_request_body_dtor(&body);
 }
 /* }}} */
 
@@ -868,6 +886,9 @@ PHP_FUNCTION(http_post_fields)
 
 /* {{{ proto string http_put_file(string url, string file[, array options[, array &info]])
  *
+ * Performs an HTTP PUT request, uploading file.
+ * Returns the HTTP response as string.
+ * See http_get() for a full list of available options.
  */
 PHP_FUNCTION(http_put_file)
 {
@@ -912,6 +933,9 @@ PHP_FUNCTION(http_put_file)
 
 /* {{{ proto string http_put_stream(string url, resource stream[, array options[, array &info]])
  *
+ * Performs an HTTP PUT request, uploading stream.
+ * Returns the HTTP response as string.
+ * See http_get() for a full list of available options.
  */
 PHP_FUNCTION(http_put_stream)
 {
@@ -950,12 +974,9 @@ PHP_FUNCTION(http_put_stream)
 }
 /* }}} */
 
-/* {{{ proto bool http_request()
- */
-/* }}} */
-
 /* {{{ proto long http_request_method_register(string method)
  *
+ * Register a custom request method.
  */
 PHP_FUNCTION(http_request_method_register)
 {
@@ -976,12 +997,11 @@ PHP_FUNCTION(http_request_method_register)
 
 /* {{{ proto bool http_request_method_unregister(mixed method)
  *
+ * Unregister a previously registered custom request method.
  */
 PHP_FUNCTION(http_request_method_unregister)
 {
        zval *method;
-       zend_bool numeric;
-       unsigned long existing;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &method)) {
                RETURN_FALSE;
@@ -1013,6 +1033,7 @@ PHP_FUNCTION(http_request_method_unregister)
 
 /* {{{ proto long http_request_method_exists(mixed method)
  *
+ * Check if a request method is registered (or available by default).
  */
 PHP_FUNCTION(http_request_method_exists)
 {
@@ -1044,6 +1065,7 @@ PHP_FUNCTION(http_request_method_exists)
 
 /* {{{ proto string http_request_method_name(long method)
  *
+ * Get the literal string representation of a standard or registered request method.
  */
 PHP_FUNCTION(http_request_method_name)
 {