$uppath=$temppath.'u';
} while (( -e $headpath) or ( -e $downpath) or ( -e $uppath));
- # @curl_arg=(CURL_PATH,'-o',$downpath,'-D',$headpath); #-s
@curl_arg=(CURL_PATH,'-i','-#'); #-s
if ($ENV{'REQUEST_METHOD'} eq 'HEAD'){
}
}
close ($upfile);
+ $craetedup=1;
push @curl_arg, '--data-binary';
push @curl_arg, '@'.$uppath;
}
+
foreach $envk (keys %ENV) {
- if ($envk =~ /^(HTTP_[A-Z_]+)$/) {
+ if ($envk =~ /^(HTTP_[A-Z0-9_]+)$/) {
$headname=formatheader($1);
- if ($ENV{$envk} =~ /^([\x20-\x7e]*)$/) {
- $headval=$1;
- }
- if(lc($headname) =~ REQUEST_HEADER_BLOCK) {
- next;
- }
- unless (exists $ENV{'HTTP_USER_AGENT'}) {
- push @curl_arg, '-H';
- push @curl_arg, 'User-Agent:';
- }
- unless (exists $ENV{'HTTP_ACCEPT'}) {
- push @curl_arg, '-H';
- push @curl_arg, 'ACCEPT:';
- }
- $headval=~ s/[\r\n]//g;
- $headarg=$headname.(($headval eq '')?';':': '.$headval);
- push @curl_arg, '-H';
- push @curl_arg, $headarg;
}
+ elsif ($envk =~ /^(CONTENT_[A-Z0-9_]+)$/) {
+ $headname=formatheader($1);
+ }
+ else {
+ next;
+ }
+ if ($ENV{$envk} =~ /^([\x20-\x7e]*)$/) {
+ $headval=$1;
+ }
+ else {
+ next;
+ }
+ if(lc($headname) =~ REQUEST_HEADER_BLOCK) {
+ next;
+ }
+
+ $headarg=$headname.(($headval eq '')?';':': '.$headval);
+
+ push @curl_arg, '-H';
+ push @curl_arg, $headarg;
+ }
+ unless (exists $ENV{'HTTP_USER_AGENT'}) {
+ push @curl_arg, '-H';
+ push @curl_arg, 'User-Agent:';
+ }
+ unless (exists $ENV{'HTTP_ACCEPT'}) {
+ push @curl_arg, '-H';
+ push @curl_arg, 'ACCEPT:';
}
push @curl_arg, $URL;
close(STDREAD);
close(ERRREAD);
+ if ($createdup) {
+ unlink $uppath;
+ }
+
if($safeerror){
return fail("Status: 500 Internal Server Error\n","500 Internal Server Error",$errormsg);
}