+/* {{{ */
+#ifdef HTTP_HAVE_ZLIB
+
+/* {{{ proto string http_deflate(string data[, int flags = 0])
+ *
+ * Compress data with gzip, zlib AKA deflate or raw deflate encoding.
+ *
+ * Expects the first parameter to be a string containing the data that should
+ * be encoded.
+ *
+ * Returns the encoded string on success, or NULL on failure.
+ */
+PHP_FUNCTION(http_deflate)
+{
+ char *data;
+ int data_len;
+ long flags = 0;
+
+ RETVAL_NULL();
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &flags)) {
+ char *encoded;
+ size_t encoded_len;
+
+ if (SUCCESS == http_encoding_deflate(flags, data, data_len, &encoded, &encoded_len)) {
+ RETURN_STRINGL(encoded, (int) encoded_len, 0);
+ }
+ }
+}
+/* }}} */
+
+/* {{{ proto string http_inflate(string data)
+ *
+ * Uncompress data compressed with either gzip, deflate AKA zlib or raw
+ * deflate encoding.
+ *
+ * Expects a string as parameter containing the compressed data.
+ *
+ * Returns the decoded string on success, or NULL on failure.
+ */
+PHP_FUNCTION(http_inflate)
+{
+ char *data;
+ int data_len;
+
+ RETVAL_NULL();
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len)) {
+ char *decoded;
+ size_t decoded_len;
+
+ if (SUCCESS == http_encoding_inflate(data, data_len, &decoded, &decoded_len)) {
+ RETURN_STRINGL(decoded, (int) decoded_len, 0);
+ }
+ }
+}
+/* }}} */
+
+/* {{{ proto string ob_deflatehandler(string data, int mode)
+ *
+ * For use with ob_start(). The deflate output buffer handler can only be used once.
+ * It conflicts with ob_gzhanlder and zlib.output_compression as well and should
+ * not be used after ext/mbstrings mb_output_handler and ext/sessions URL-Rewriter (AKA
+ * session.use_trans_sid).
+ */
+PHP_FUNCTION(ob_deflatehandler)
+{
+ char *data;
+ int data_len;
+ long mode;
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &data, &data_len, &mode)) {
+ RETURN_FALSE;
+ }
+
+ http_ob_deflatehandler(data, data_len, &Z_STRVAL_P(return_value), (uint *) &Z_STRLEN_P(return_value), mode);
+ Z_TYPE_P(return_value) = Z_STRVAL_P(return_value) ? IS_STRING : IS_NULL;
+}
+/* }}} */
+
+/* {{{ proto string ob_inflatehandler(string data, int mode)
+ *
+ * For use with ob_start(). Same restrictions as with ob_deflatehandler apply.
+ */
+PHP_FUNCTION(ob_inflatehandler)
+{
+ char *data;
+ int data_len;
+ long mode;
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &data, &data_len, &mode)) {
+ RETURN_FALSE;
+ }
+
+ http_ob_inflatehandler(data, data_len, &Z_STRVAL_P(return_value), (uint *) &Z_STRLEN_P(return_value), mode);
+ Z_TYPE_P(return_value) = Z_STRVAL_P(return_value) ? IS_STRING : IS_NULL;
+}
+/* }}} */
+
+#endif /* HTTP_HAVE_ZLIB */
+/* }}} */
+
+/* {{{ proto int http_support([int feature = 0])
+ *
+ * Check for feature that require external libraries.
+ *
+ * Accpepts an optional in parameter specifying which feature to probe for.
+ * If the parameter is 0 or omitted, the return value contains a bitmask of
+ * all supported features that depend on external libraries.
+ *
+ * Available features to probe for are:
+ * <ul>
+ * <li> HTTP_SUPPORT: always set
+ * <li> HTTP_SUPPORT_REQUESTS: whether ext/http was linked against libcurl,
+ * and HTTP requests can be issued
+ * <li> HTTP_SUPPORT_SSLREQUESTS: whether libcurl was linked against openssl,
+ * and SSL requests can be issued
+ * <li> HTTP_SUPPORT_ENCODINGS: whether ext/http was linked against zlib,
+ * and compressed HTTP responses can be decoded
+ * <li> HTTP_SUPPORT_MAGICMIME: whether ext/http was linked against libmagic,
+ * and the HttpResponse::guessContentType() method is usable
+ * </ul>
+ *
+ * Returns int, whether requested feature is supported, or a bitmask with
+ * all supported features.
+ */
+PHP_FUNCTION(http_support)
+{
+ long feature = 0;
+
+ RETVAL_LONG(0L);
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &feature)) {
+ RETVAL_LONG(http_support(feature));
+ }
+}
+/* }}} */
+
+PHP_FUNCTION(http_test)
+{
+}
+