- ws
[m6w6/ext-http] / http_api.c
index 8030c0f5d358df3f1bb5360d3cb57d6e3b7969a4..a392801401de9cf2f77e437511dadfd44bd90bc6 100644 (file)
@@ -50,7 +50,6 @@ PHP_MINIT_FUNCTION(http_support)
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_REQUESTS", HTTP_SUPPORT_REQUESTS);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_MAGICMIME", HTTP_SUPPORT_MAGICMIME);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_ENCODINGS", HTTP_SUPPORT_ENCODINGS);
-       HTTP_LONG_CONSTANT("HTTP_SUPPORT_MHASHETAGS", HTTP_SUPPORT_MHASHETAGS);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_SSLREQUESTS", HTTP_SUPPORT_SSLREQUESTS);
        
        return SUCCESS;
@@ -66,9 +65,6 @@ PHP_HTTP_API long _http_support(long feature)
        support |= HTTP_SUPPORT_SSLREQUESTS;
 #      endif
 #endif
-#ifdef HTTP_HAVE_MHASH
-       support |= HTTP_SUPPORT_MHASHETAGS;
-#endif
 #ifdef HTTP_HAVE_MAGIC
        support |= HTTP_SUPPORT_MAGICMIME;
 #endif
@@ -88,7 +84,7 @@ char *_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool x
        if (key && key_len) {
                size_t i;
                int wasalpha;
-               if (wasalpha = isalpha((int) key[0])) {
+               if ((wasalpha = isalpha((int) key[0]))) {
                        key[0] = (char) (uctitle ? toupper((int) key[0]) : tolower((int) key[0]));
                }
                for (i = 1; i < key_len; i++) {
@@ -246,6 +242,12 @@ void _http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC)
 }
 /* }}} */
 
+static void http_ob_blackhole(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
+{
+       *handled_output = ecalloc(1,1);
+       *handled_output_len = 0;
+}
+
 /* {{{ STATUS http_exit(int, char*, char*) */
 STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header TSRMLS_DC)
 {
@@ -257,6 +259,7 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
                return FAILURE;
        }
        
+       php_end_ob_buffers(0 TSRMLS_CC);
        if (php_header(TSRMLS_C) && body) {
                PHPWRITE(body, strlen(body));
        }
@@ -275,8 +278,12 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
        STR_FREE(header);
        STR_FREE(body);
        
-       zend_bailout();
-       /* fake */
+       if (HTTP_G(force_exit)) {
+               zend_bailout();
+       } else {
+               php_ob_set_internal_handler(http_ob_blackhole, 4096, "blackhole", 0 TSRMLS_CC);
+       }
+       
        return SUCCESS;
 }
 /* }}} */