]> granicus.if.org Git - php/commitdiff
@- Fixed some modules to allow using output-buffering. (Thies)
authorThies C. Arntzen <thies@php.net>
Thu, 15 Feb 2001 14:49:01 +0000 (14:49 +0000)
committerThies C. Arntzen <thies@php.net>
Thu, 15 Feb 2001 14:49:01 +0000 (14:49 +0000)
i nuked all unneded calls to php_header() - i'm not too sure how we do
handle HEAD Requests as they were only detected via php_header(). but calling
php_header from a module makes output-buffering unusable.

NOTICE: there is some EBSDIC stuff in gd.c - i think it's obsolete.

ext/cpdf/cpdf.c
ext/gd/gd.c
ext/gd/gd_ctx.c
ext/hyperwave/hw.c
ext/interbase/interbase.c
ext/oci8/oci8.c
ext/pdf/pdf.c
ext/standard/file.c
ext/standard/iptc.c

index 5bf8ea2900f01b99499dd898a7803d45b55cfcd9..0e32963872c32d770c8849ba32c65db64143fd90 100644 (file)
@@ -2226,7 +2226,7 @@ PHP_FUNCTION(cpdf_output_buffer) {
        }
 
        buffer = cpdf_getBufferForPDF(pdf, &lenght);
-       php_header();
+
        php_write(buffer, lenght);
 
        RETURN_TRUE;
index 1a8ebe507df24b8419155277384d11621fcf8d85..32defd355a131096d7c14619a3f8264f206a64b6 100644 (file)
@@ -853,33 +853,35 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
                        php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name());
                        RETURN_FALSE;
                }
-               output = php_header();
-               if (output) {
-                       switch(image_type) {
-                               case PHP_GDIMG_TYPE_JPG:
-                                       (*func_p)(im, tmp, q);
-                                       break;
-                               case PHP_GDIMG_TYPE_WBM:
-                                       if(q<0||q>255) {
-                                               php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q);
-                                       }
-                                       (*func_p)(im, q, tmp);
-                                       break;
-                               default:
-                                       (*func_p)(im, tmp);
-                                       break;
-                       }
 
-            fseek(tmp, 0, SEEK_SET);
+               switch(image_type) {
+                       case PHP_GDIMG_TYPE_JPG:
+                               (*func_p)(im, tmp, q);
+                               break;
+                       case PHP_GDIMG_TYPE_WBM:
+                               if(q<0||q>255) {
+                                       php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q);
+                               }
+                               (*func_p)(im, q, tmp);
+                               break;
+                       default:
+                               (*func_p)(im, tmp);
+                               break;
+               }
+
+               fseek(tmp, 0, SEEK_SET);
+
 #if APACHE && defined(CHARSET_EBCDIC)
-                       SLS_FETCH();
-            /* This is a binary file already: avoid EBCDIC->ASCII conversion */
-            ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
+               /* XXX this is unlikely to work any more thies@thieso.net */
+
+               SLS_FETCH();
+               /* This is a binary file already: avoid EBCDIC->ASCII conversion */
+               ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
 #endif
-            while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) {
-                php_write(buf, b);
-            }
-        }
+               while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) {
+                       php_write(buf, b);
+               }
+
         fclose(tmp);
         /* the temporary file is automatically deleted */
        }
index f54b8a5b96a13144567bdfc45eccdd95a94ab402..f187483e23146da5c48383640ffc9599a875a563 100644 (file)
@@ -61,15 +61,13 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
 
                ctx = gdNewFileCtx(fp);
        } else {
-               if(!php_header()) {
-                       RETURN_TRUE;
-               }
                ctx = emalloc(sizeof(gdIOCtx));
                ctx->putC = _php_image_output_putc;
                ctx->putBuf = _php_image_output_putbuf;
                ctx->free = _php_image_output_ctxfree;
 
 #if APACHE && defined(CHARSET_EBCDIC)
+               /* XXX this is unlikely to work any more thies@thieso.net */
                SLS_FETCH();
                /* This is a binary file already: avoid EBCDIC->ASCII conversion */
                ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
index 12f4b195ca9c5330e25ebe0da182a216d6582abc..39e5b06be0e0375ca2429f9cf5e271350c2f08f2 100644 (file)
@@ -2766,8 +2766,7 @@ PHP_FUNCTION(hw_output_document) {
                RETURN_FALSE;
        }
 
-       if(php_header())
-               php_write(ptr->data, ptr->size);
+       php_write(ptr->data, ptr->size);
 
        RETURN_TRUE;
 }
index a1806b0976e92fdc2a68addb8337c42f5429f207..2a815fec2082df5871864ef66b94c7d56d4551fc 100644 (file)
@@ -2831,10 +2831,6 @@ PHP_FUNCTION(ibase_blob_echo)
 
        GET_BLOB_ID_ARG(blob_arg, ib_blob_id);
        
-       if (!php_header()) {
-               RETURN_FALSE;
-       }
-
        if (ib_blob_id) { /*not null ?*/
                
                if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
index b8c5d5807ebd47bf0e8d7d399ae67c30a84df6ad..f504827e0cb2b16b717d85103685ca428fef4735 100644 (file)
@@ -834,9 +834,7 @@ static void oci_debug(const char *format, ...)
                vsnprintf(buffer, sizeof(buffer)-1, format, args);
                va_end(args);
                buffer[sizeof(buffer)-1] = '\0';
-               if (php_header()) {
-                       php_printf("OCIDebug: %s<br>\n", buffer);
-               }
+               php_printf("OCIDebug: %s<br>\n", buffer);
        }
 }
 
@@ -2959,9 +2957,7 @@ PHP_FUNCTION(ociwritelobtofile)
                                        goto bail;
                                }
                        } else {
-                               if (php_header()) {
-                                       PHPWRITE(buffer,toread);
-                               }
+                               PHPWRITE(buffer,toread);
                        }
 
                        length -= toread;
index b42227355dc6d7ee1ed54cb74d77c76f1d6b0b86..c8bc7283014387538f950d114f6fbc23d8324390 100644 (file)
@@ -250,7 +250,7 @@ static void pdf_efree(PDF *p, void *mem)
 
 static size_t pdf_flushwrite(PDF *p, void *data, size_t size)
 {
-       if(php_header()) return(php_write(data, size));
+       return(php_write(data, size));
        return 0;
 }
 
index 63d14053d981c7485d96db9c4c5c402e7b9844e8..e8e5448d39014caa3e216922e77db34de52ace98 100644 (file)
@@ -1437,9 +1437,7 @@ PHP_FUNCTION(readfile)
                rsrc_id = ZEND_REGISTER_RESOURCE(NULL,fp,php_file_le_fopen());
        }
 
-       if (php_header()) {
-               size = php_passthru_fd(socketd, fp, issock);
-       }
+       size = php_passthru_fd(socketd, fp, issock);
 
        zend_list_delete(rsrc_id);
 
@@ -1497,12 +1495,10 @@ PHP_FUNCTION(fpassthru)
                socketd=*(int*)what;
        }
 
-       size = 0;
-       if (php_header()) { /* force headers if not already sent */
-               size = php_passthru_fd(socketd, (FILE*) what, issock);
-       }
+       size = php_passthru_fd(socketd, (FILE*) what, issock);
 
        zend_list_delete((*arg1)->value.lval);
+
        RETURN_LONG(size);
 }
 /* }}} */
index 0fdab46b2ce3b2df0e164b39e5d781c5692ad5c0..4865d0c05018fe978e07f44c476f37bace5c887f 100644 (file)
@@ -203,16 +203,6 @@ PHP_FUNCTION(iptcembed)
         RETURN_FALSE;
     }
 
-       if (spool > 0) 
-               if (!php_header()){  /* we got a HEAD request. */
-                       if (spool == 2){ 
-                               RETURN_TRUE;    /* we only wanted to spool - report success. */
-                       } else 
-                       if (spool == 1) {
-                               spool = 0;              /* we wanted the file to be spooled/returned, just return it */
-                       }
-               }
-
        len = (*iptcdata)->value.str.len;
 
        if (spool < 2) {