in reply to How to change content-length in CGI

Hi, are you seeking for help for the sending client script or for the receiving server script?

Some code would be helpful, so one knows how you do it.

  • Comment on Re: How to change content-length in CGI

Replies are listed 'Best First'.
Re^2: How to change content-length in CGI
by Anonymous Monk on Jan 05, 2009 at 12:21 UTC

    Standalone script

    #!/usr/bin/perl use strict; use warnings; use LWP::Simple::Post qw(post); #binary file open(FH, "binaryfile"); my $Data = do{local $/; <FH>}; close(FH); my $url = 'http://localhost:8080/cgi-bin/index.pl'; my $content = post($url, $Data); print $content;

    Server script

    #!/usr/bin/perl use strict; use CGI; my $q = new CGI; print "\nMethod :", $ENV{REQUEST_METHOD}; print "\nContent_Length : ", $ENV{CONTENT_LENGTH}; #binary file open (FH, ">binaryoutput"); print FH $q->param() if ($q->param()); close(FH);

    In the server script, i need to do several process and also i don't want to upload concept. For some concept, I want to post the data and retrive in the server look like parameters

      Could this be another binmode issue? Try adding a binmode FH right after opening your file. You could also print out the length of $Data right before you post it to make sure it's the size you're expecting.