rawlinp opened a new pull request #2977: Prevent Perl input record separator 
change in TO dbdump API
URL: https://github.com/apache/trafficcontrol/pull/2977
 
 
   #### What does this PR do?
   
   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) in the `do` block, subsequent
   calls to `chomp()` actually strip newlines because `$/ == "\n"` by
   default.
   
   #### Which TC components are affected by this PR?
   
   - [ ] Documentation
   - [ ] Grove
   - [ ] Traffic Analytics
   - [ ] Traffic Monitor
   - [x] Traffic Ops
   - [ ] Traffic Ops ORT
   - [ ] Traffic Portal
   - [ ] Traffic Router
   - [ ] Traffic Stats
   - [ ] Traffic Vault
   - [ ] Other _________
   
   #### What is the best way to verify this PR?
   ```
   curl -kvs -H "$MOJO_COOKIE" "https://trafficops.example.com/api/1.2/dbdump"; 
-OJ
   ```
   
   #### Check all that apply
   
   - [ ] This PR includes tests
   - [ ] This PR includes documentation updates
   - [ ] This PR includes an update to CHANGELOG.md
   - [ ] This PR includes all required license headers
   - [ ] This PR includes a database migration (ensure that migration sequence 
is correct)
   - [ ] This PR fixes a serious security flaw. Read more: 
[www.apache.org/security](http://www.apache.org/security/)
   
   <!--
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
   -->
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to