From ffb908ab49cb5827ed2b15e9b9d2132a88fc551f Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 13 Jun 2020 14:25:00 -0400 Subject: [PATCH] Don't replace LF with CRLF in body of HTTP request Now the Content-Length header matches the actual length of the body. Also, don't replace an LF with CRLF if it is already preceeded by CR. --- ddclient | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ddclient b/ddclient index ccd55a6..06bc895 100755 --- a/ddclient +++ b/ddclient @@ -2004,7 +2004,7 @@ sub geturl { my $method = shift || 'GET'; my $data = shift || ''; my ($peer, $server, $port, $default_port, $use_ssl); - my ($sd, $rq, $request, $reply); + my ($sd, $request, $reply); ## canonify proxy and url my $force_ssl; @@ -2063,10 +2063,11 @@ sub geturl { $headers .= "\n" if $headers ne '' && substr($headers, -1) ne "\n"; $request .= $headers; $request .= "\n"; + # RFC 7230 says that all lines before the body must end with . + (my $rq = $request) =~ s/(? for some pedantic proxy servers - ($rq = $request) =~ s/\n/\r\n/g; $0 = sprintf("%s - connecting to %s port %s", $program, $peer, $port); if (!opt('exec')) {