Hi, I have a peer that does an HTTP PUT using curl to my apache 2.2.25 
running a cgi written in c.
Under certain conditions, the cgi-bin terminates with an HTTP error 
status, like 400. This will keep a file from being uploaded as expected.
However, when the content-length of the upload is unspecified, the 
uploading peer doesn't receive this error status until it's actually done 
transmitting the entire upload.
This is a problem when PUTting a continuous stream because the peer 
will never notice that the server actually denied receiving the stream.
Is there a way to forcefully disconnect the client from within the cgi-bin or 
keep apache from sending the 100 - continue statement right away?
Maybe somebody has another idea of how to work around this.
There's a minimal example for testing this scenario in the attachment.

Thanks for your help!
--Fraxinas
#include <stdio.h> 
#include <string.h> 
#include <stdlib.h> 
int main(int argc, char *argv[])
{
    char* arguments = getenv("QUERY_STRING");
  
    if (!arguments || strlen(arguments) != 10)
    {
        fprintf(stdout, "Status: %i\r\nConnection: Close\r\nContent-Type: text/html\r\n\r\nInvalid argument data: %s\r\n", 400, arguments);fflush(stdout);
	exit(-1);
    }   

    fprintf(stdout,"Status: 201\r\nConnection: Close\r\nContent-Type: text/html\r\n\r\nCreated the resource\r\n");
    exit(0);
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to