You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by dg...@apache.org on 2018/11/26 14:38:17 UTC
[trafficcontrol] branch 3.0.x updated: Prevent Perl input record
separator change in TO dbdump API
This is an automated email from the ASF dual-hosted git repository.
dgelinas pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/3.0.x by this push:
new 0b1756d Prevent Perl input record separator change in TO dbdump API
0b1756d is described below
commit 0b1756d5b1ea1255bcfff5f6149f7aa44721a9c5
Author: Rawlin Peters <ra...@comcast.com>
AuthorDate: Wed Oct 31 14:15:49 2018 -0600
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.
(cherry picked from commit 612bedd89c31e3e0187705411a1ffb281cf453bf)
---
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 caf6598..bd277c8 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>;