From 419fcf9e6c3145defee24d725ced5394505d0d12 Mon Sep 17 00:00:00 2001 From: Rawlin Peters Date: Wed, 31 Oct 2018 14:15:49 -0600 Subject: [PATCH] Prevent Perl input record separator change in TO dbdump API Due to the way this code was previously written, the first call to the dbdump API is successful, but subsequent calls are broken because the chomp() function no longer strips trailing whitespace from the output of the `hostname` command. This ends up breaking the response headers because of the unexpected newline, causing traffic_ops_golang to emit this error and return a 502: http: proxy error: net/http: HTTP/1.x transport connection broken: malformed MIME header line: -20181031125221.pg_dump" By only locally declaring $/ (undefined), subsequent calls to `chomp()` actually strip newlines because `$/ == "\n"` by default. --- traffic_ops/app/lib/API/Database.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_ops/app/lib/API/Database.pm b/traffic_ops/app/lib/API/Database.pm index caf6598e6f..bd277c8ce7 100644 --- a/traffic_ops/app/lib/API/Database.pm +++ b/traffic_ops/app/lib/API/Database.pm @@ -40,7 +40,7 @@ sub dbdump { } # slurp it in.. - undef $/; + local $/; my $data = <$fh>;