newbie cgi question

Discussion in 'HTML' started by jcatron@swbell.net, Nov 11, 2003.

  1. Guest

    I'm writing some bash cgi scripts and notice that the client html
    screen will not update until the bash script ends. If I flood the
    client with text after the html part, only the text will appear on the
    client screen before script ends. How can I send html docs to client,
    have them written to client screen, without the bash cgi script
    ending?

    Thanks
     
    , Nov 11, 2003
    #1
    1. Advertising

  2. jcatron wrote:

    > I'm writing some bash cgi scripts and notice that the client html
    > screen will not update until the bash script ends.


    This *sounds* like a client "feature".

    Do you have a URL for us to check?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Nov 11, 2003
    #2
    1. Advertising

  3. Guest

    Sadly, I am working with a restricted government WAN, unaccessable
    from the outside. Could be client side; it is windows xp using ie5
    (I think, could be higher version of ie). I have implemented a
    workaround but it's very unelegant.

    Bash doesn't have an easy way to flush buffers. I might try pumping
    the html into a c executable that flushes just to see what happens.

    Original problem came up when parent bash spawned working script.
    Parent bash tries to die but becomes defunct since child still
    running; client screen unchanged until child dies and defucnt parent
    finally drops out.

    On Tue, 11 Nov 2003 18:29:57 +0000, Toby A Inkster
    <> wrote:

    >jcatron wrote:
    >
    >> I'm writing some bash cgi scripts and notice that the client html
    >> screen will not update until the bash script ends.

    >
    >This *sounds* like a client "feature".
    >
    >Do you have a URL for us to check?
     
    , Nov 11, 2003
    #3
  4. In article <>,
    says...
    > I'm writing some bash cgi scripts and notice that the client html
    > screen will not update until the bash script ends. If I flood the
    > client with text after the html part, only the text will appear on the
    > client screen before script ends. How can I send html docs to client,
    > have them written to client screen, without the bash cgi script
    > ending?
    >

    Can you flush stdout at certain stages in your script?

    --
    Hywel I do not eat quiche
    http://hyweljenkins.co.uk/
    http://hyweljenkins.co.uk/mfaq.php
     
    Hywel Jenkins, Nov 11, 2003
    #4
  5. jcatron wrote:

    > Bash doesn't have an easy way to flush buffers.


    I *think* bash flushes buffers at end of line. (Similar to Perl's default
    behaviour). I have tested with this CGI file (and yes, /bin/sh is a
    symlink to bash):

    #!/bin/sh
    echo "Content-Type: text/plain"
    echo ""
    echo "Hello"
    sleep 10
    echo "World"

    by telnetting into the web server and requesting the file:

    GET /tobyink/test.cgi HTTP/1.1
    Host: www

    and it seems to print out "Hello", wait a while and then print out "World"
    -- that is, it doesn't wait for the entire script to complete before
    printing out "Hello".

    This is why I think it must be a client "feature".

    Of course, it is possible that if "sleep 10" was replaced by a more CPU
    intensive statement, flushing the buffer would be given a lower priority,
    so might not happen until after the next statement had executed. You may
    be able to solve that with "nice" (man 1 nice)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Nov 12, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jürgen Exner

    Re: CGI Perl "use CGI" statement fail

    Jürgen Exner, Jul 31, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,480
    Jürgen Exner
    Jul 31, 2003
  2. Shailan
    Replies:
    2
    Views:
    1,069
    Shailan
    Dec 15, 2003
  3. John Smith
    Replies:
    0
    Views:
    3,162
    John Smith
    May 15, 2006
  4. LarsenMTL
    Replies:
    4
    Views:
    782
    Eric Walstad
    Nov 4, 2004
  5. Ted Byers
    Replies:
    19
    Views:
    694
    Ilya Zakharevich
    Nov 30, 2009
Loading...

Share This Page