multipart/x-mixed-replace not working, I think its due to buffering or caching

Discussion in 'Server Operation' started by Nap, Jul 13, 2016.

  1. Nap

    Nap Member

    Hi,
    I'm testing some code that uses Content-Type: multipart/x-mixed-replace;boundary=$separator to push updates from the server to the browser. The script shows two pages in succession; one that says 'processing' in the middle of the screen, and a second one that renders the page I actually want to see. I've put a 10 second sleep between the pages in the script. On my 'toy' server, I see the first page, wait 10 seconds and then get the second page. On my dev server however, I see an empty page for 10 seconds and then the second page is rendered. So I never see the 'Processing' message page.
    My 'toy' server is Wamp 2.2 running locally on the windows machine I'm using to edit the script. My dev server is based on U14.04 and runs in a VM on another LAN connected PC. The dev server is configured as per my sig.

    I have a very strong suspision that my problem is related to caching and/or buffering on the dev server because all the output (first and second page) is eventually received in my browser, but in a single chunk. Using FireFox's Inspector I can see that nothing is in the browser until the 10 second delay expires and then I get the whole lot. I have tried sending a bunch of whitespaces (approx 5000) after the first page so as to overflow the buffer. I have tried using the Cache-Control: no-cache header, and I have also tried flushing the buffer between pages. But nothing at a scripting level seems to make it work.

    Has anyone done this before? Anyone have any ideas on what's going wrong?

    Cheers,
    Nap
    -------------------
    I can supply the script ('HV_HttpMultipart') if necessary, I retrieved it from phpClasses.com. I have turned off output_buffering and zlib compression in my php.ini file, but can supply more information about my php.ini and httpd.conf and other apache2 settings if asked. As I think it's just a matter of disabling a certain apache mod, here are the Apache modules that I have enabled. The first part of the list shows mods that are used in both my WAMP server and U14.04. Then second part is U14.04 only, and the third is WAMP only.
    Code:
    Addons used in both WAMP and U14.04
    ===============================================================
    actions.conf -> ../mods-available/actions.conf
    actions.load -> ../mods-available/actions.load
    alias.conf -> ../mods-available/alias.conf
    alias.load -> ../mods-available/alias.load
    auth_basic.load -> ../mods-available/auth_basic.load
    auth_digest.load -> ../mods-available/auth_digest.load
    authn_file.load -> ../mods-available/authn_file.load
    authz_host.load -> ../mods-available/authz_host.load
    authz_user.load -> ../mods-available/authz_user.load
    autoindex.conf -> ../mods-available/autoindex.conf
    autoindex.load -> ../mods-available/autoindex.load
    cgi.load -> ../mods-available/cgi.load
    deflate.conf -> ../mods-available/deflate.conf
    deflate.load -> ../mods-available/deflate.load
    dir.conf -> ../mods-available/dir.conf
    dir.load -> ../mods-available/dir.load
    env.load -> ../mods-available/env.load
    include.load -> ../mods-available/include.load
    mime.conf -> ../mods-available/mime.conf
    mime.load -> ../mods-available/mime.load
    negotiation.conf -> ../mods-available/negotiation.conf
    negotiation.load -> ../mods-available/negotiation.load
    rewrite.load -> ../mods-available/rewrite.load
    setenvif.conf -> ../mods-available/setenvif.conf
    setenvif.load -> ../mods-available/setenvif.load
    
    Addons used only in U14.04
    ===============================================================
    access_compat.load -> ../mods-available/access_compat.load
    authn_core.load -> ../mods-available/authn_core.load
    authz_core.load -> ../mods-available/authz_core.load
    dav_fs.conf -> ../mods-available/dav_fs.conf
    dav_fs.load -> ../mods-available/dav_fs.load
    dav.load -> ../mods-available/dav.load
    fastcgi.conf -> ../mods-available/fastcgi.conf
    fastcgi.load -> ../mods-available/fastcgi.load
    fcgid.conf -> ../mods-available/fcgid.conf
    fcgid.load -> ../mods-available/fcgid.load
    filter.load -> ../mods-available/filter.load              (deflate needs this)
    headers.load -> ../mods-available/headers.load             (needed by security.conf)
    mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
    mpm_prefork.load -> ../mods-available/mpm_prefork.load
    php5.conf -> ../mods-available/php5.conf
    php5.load -> ../mods-available/php5.load
    python.load -> ../mods-available/python.load
    socache_shmcb.load -> ../mods-available/socache_shmcb.load       (ssl needs this)
    ssl.conf -> ../mods-available/ssl.conf
    ssl.load -> ../mods-available/ssl.load
    status.conf -> ../mods-available/status.conf
    status.load -> ../mods-available/status.load
    suexec.load -> ../mods-available/suexec.load
    suphp.conf -> ../mods-available/suphp.conf
    suphp.load -> ../mods-available/suphp.load
    unique_id.load -> ../mods-available/unique_id.load
    
    WAMP Only:
    LoadModule asis_module modules/mod_asis.so
    LoadModule authn_default_module modules/mod_authn_default.so
    LoadModule authz_default_module modules/mod_authz_default.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule isapi_module modules/mod_isapi.so
    LoadModule log_config_module modules/mod_log_config.so
    LoadModule php5_module "c:/wamp/bin/php/php5.3.13/php5apache2_2.dll"
    
    
     

Share This Page