Fix regex searching for Content-Type header
* Add the `m` modifier because the `$headers` variable can contain multiple headers. If `$headers` contains a Content-Type header but it is the second or later header then the regex won't match without `m`. * Add the `i` modifier because RFC 7230 says that header field names are case-insensitive. * Don't require a space after the colon because RFC 7230 says that the space is optional.
This commit is contained in:
parent
7d094c0976
commit
fe3893e26a
1 changed files with 1 additions and 1 deletions
2
ddclient
2
ddclient
|
@ -2046,7 +2046,7 @@ sub geturl {
|
|||
$request .= "Authorization: Basic $auth\n" if $login || $password;
|
||||
$request .= "User-Agent: ${program}/${version}\n";
|
||||
if ($data) {
|
||||
$request .= "Content-Type: application/x-www-form-urlencoded\n" if !$headers =~ /^Content-Type: /;
|
||||
$request .= "Content-Type: application/x-www-form-urlencoded\n" if $headers !~ /^Content-Type:/mi;
|
||||
$request .= "Content-Length: " . length($data) . "\n";
|
||||
}
|
||||
$request .= "Connection: close\n";
|
||||
|
|
Loading…
Reference in a new issue