OpenVMS Source Code Demos
DO_100K.C
/*
**	Title : do_100k.c
**	Author: OpenVMS Engineering
**	Date  : 25-JUN-2004
**
**	Program to reproduce a customer problem. They are using BASIC
**	in a CGI program to generate approximately 105K bytes of content.
**	CSWS 2.0 serves them the 1st time, but chokes on consequent ones.
**	Error log indicates it accually chokes on the 1st one too.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
    int recnum;
    char ten[11] = "1234567890";
    char numbuf[120];
    int i;
    printf ("Status: 200\n");
    printf ("Content-type: text/html\n\n");
    printf ("<HTML><HEAD></HEAD><BODY><PRE>\n");
    printf ("This page will return 1000 lines of 105 characters\n");
    printf ("If you don't see 1000 lines then your Apache implementation is broken\n");
    for (recnum = 0; recnum < 1000; recnum++) {
        sprintf(numbuf, "%04d ", recnum);
        for (i = 0; i < 10; i++) {
            strcat(numbuf,ten);
        }
        printf("%s\n", numbuf);
    }
    printf("</PRE></BODY></HTML>\n");
    return;
}

Back to 
Home
Neil Rieck
Waterloo, Ontario, Canada.