cgi-bin disconnecting upload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux