Merge pull request #173 from rhansen/request-body-crlf
Don't replace LF with CRLF in body of HTTP request
This commit is contained in:
commit
35eac827e3
1 changed files with 4 additions and 3 deletions
7
ddclient
7
ddclient
|
@ -2004,7 +2004,7 @@ sub geturl {
|
||||||
my $method = shift || 'GET';
|
my $method = shift || 'GET';
|
||||||
my $data = shift || '';
|
my $data = shift || '';
|
||||||
my ($peer, $server, $port, $default_port, $use_ssl);
|
my ($peer, $server, $port, $default_port, $use_ssl);
|
||||||
my ($sd, $rq, $request, $reply);
|
my ($sd, $request, $reply);
|
||||||
|
|
||||||
## canonify proxy and url
|
## canonify proxy and url
|
||||||
my $force_ssl;
|
my $force_ssl;
|
||||||
|
@ -2063,10 +2063,11 @@ sub geturl {
|
||||||
$headers .= "\n" if $headers ne '' && substr($headers, -1) ne "\n";
|
$headers .= "\n" if $headers ne '' && substr($headers, -1) ne "\n";
|
||||||
$request .= $headers;
|
$request .= $headers;
|
||||||
$request .= "\n";
|
$request .= "\n";
|
||||||
|
# RFC 7230 says that all lines before the body must end with <cr><lf>.
|
||||||
|
(my $rq = $request) =~ s/(?<!\r)\n/\r\n/g;
|
||||||
$request .= $data;
|
$request .= $data;
|
||||||
|
$rq .= $data;
|
||||||
|
|
||||||
## make sure newlines are <cr><lf> for some pedantic proxy servers
|
|
||||||
($rq = $request) =~ s/\n/\r\n/g;
|
|
||||||
|
|
||||||
$0 = sprintf("%s - connecting to %s port %s", $program, $peer, $port);
|
$0 = sprintf("%s - connecting to %s port %s", $program, $peer, $port);
|
||||||
if (!opt('exec')) {
|
if (!opt('exec')) {
|
||||||
|
|
Loading…
Reference in a new issue