You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Mike Gerdts <Mi...@alcatel.com> on 2002/02/27 16:13:00 UTC

os-windows/9979: multipart-mixed data sent all at once

>Number:         9979
>Category:       os-windows
>Synopsis:       multipart-mixed data sent all at once
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Feb 27 07:20:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michael.Gerdts@alcatel.com
>Release:        1.3.23
>Organization:
apache
>Environment:
Windows 2000, SP2
Installed from apache_1.3.23-win32-x86-no_src.msi
>Description:
I am attempting to write a cross-platform server push cgi program.  It works fine on Linux and Solaris (apache 1.3.2[23]).  On Win2k the data seems to be buffered until the CGI script exits.  I have implemented push.cgi in both Tcl and C.  Since I don't expect that most people have Tcl installed, the C version appears below.  It compiles cleanly with cygwin's gcc using "gcc -Wall -o push.exe push.c".  To resolve DLL hell, the cygwin DLLs were copied into the cgi-bin directory.  Also, changing term to "\r\n" has no effect.

My reference for implementing this was http://www.netscape.com/assist/net_sites/pushpull.html


#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

char *boundary = "FooBar";
char *term = "\n";

int main() {
    int i;
	printf("Content-type: multipart/mixed;boundary=%s%s%s", boundary, term, term);

    for ( i=0 ; i<15 ; i++ ) {
        printf("--%s%sContent-type: text/plain%s%sYou have been watching for %d seconds.%s",
                boundary, term, term, term, i, term);
        fflush(stdout);
        sleep(1);
    }

    printf("--%s--%s", boundary, term);
    exit(0);
}
>How-To-Repeat:
Compile the code above, stick the resulting .exe in your cgi-bin directory.  Be sure that windows can find the cygwin dlls if necessary.
>Fix:
Nope, but pointers to the right code to fix would help me greatly.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]