Skip to content

Commit

Permalink
lwp-request didn't respect -H Content-type [RT#70488]
Browse files Browse the repository at this point in the history
  • Loading branch information
gisle committed Oct 15, 2011
1 parent ed6d5e2 commit 308ca5c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bin/lwp-request
Expand Up @@ -368,6 +368,7 @@ if (defined $options{'i'}) {
} }


$content = undef; $content = undef;
$user_ct = undef;
if ($allowed_methods{$method} eq "C") { if ($allowed_methods{$method} eq "C") {
# This request needs some content # This request needs some content
unless (defined $options{'c'}) { unless (defined $options{'c'}) {
Expand All @@ -378,7 +379,8 @@ if ($allowed_methods{$method} eq "C") {
} }
else { else {
die "$progname: Illegal Content-type format\n" die "$progname: Illegal Content-type format\n"
unless $options{'c'} =~ m,^[\w\-]+/[\w\-.+]+(?:\s*;.*)?$, unless $options{'c'} =~ m,^[\w\-]+/[\w\-.+]+(?:\s*;.*)?$,;
$user_ct++;
} }
print STDERR "Please enter content ($options{'c'}) to be ${method}ed:\n" print STDERR "Please enter content ($options{'c'}) to be ${method}ed:\n"
if -t; if -t;
Expand All @@ -400,7 +402,8 @@ for my $user_header (@{ $options{'H'} || [] }) {
} }
#$request->header('Accept', '*/*'); #$request->header('Accept', '*/*');
if ($options{'c'}) { # will always be set for request that wants content if ($options{'c'}) { # will always be set for request that wants content
$request->header('Content-Type', $options{'c'}); my $header = ($user_ct ? 'header' : 'init_header');
$request->$header('Content-Type', $options{'c'});
$request->header('Content-Length', length $content); # Not really needed $request->header('Content-Length', length $content); # Not really needed
$request->content($content); $request->content($content);
} }
Expand Down

0 comments on commit 308ca5c

Please sign in to comment.