You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/03/17 13:00:37 UTC

[GitHub] [trafficcontrol] alficles commented on a change in pull request #5641: Fix atscfg header rewrite injection

alficles commented on a change in pull request #5641:
URL: https://github.com/apache/trafficcontrol/pull/5641#discussion_r595986900



##########
File path: lib/go-atscfg/headerrewritedotconfig.go
##########
@@ -23,74 +23,300 @@ import (
 	"errors"
 	"fmt"
 	"math"
+	"net/url"
 	"regexp"
 	"strconv"
 	"strings"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
-	"github.com/apache/trafficcontrol/lib/go-util"
 )
 
 const HeaderRewritePrefix = "hdr_rw_"
+const HeaderRewriteMidPrefix = "hdr_rw_mid_"
 const ContentTypeHeaderRewriteDotConfig = ContentTypeTextASCII
 const LineCommentHeaderRewriteDotConfig = LineCommentHash
 
 const ServiceCategoryHeader = "CDN-SVC"
 
 const MaxOriginConnectionsNoMax = 0 // 0 indicates no limit on origin connections
 
+const HeaderRewriteFirstPrefix = HeaderRewritePrefix + "first_"
+const HeaderRewriteInnerPrefix = HeaderRewritePrefix + "inner_"
+const HeaderRewriteLastPrefix = HeaderRewritePrefix + "last_"
+
+func FirstHeaderRewriteConfigFileName(dsName string) string {
+	return HeaderRewriteFirstPrefix + dsName + ConfigSuffix
+}
+
+func InnerHeaderRewriteConfigFileName(dsName string) string {
+	return HeaderRewriteInnerPrefix + dsName + ConfigSuffix
+}
+
+func LastHeaderRewriteConfigFileName(dsName string) string {
+	return HeaderRewriteLastPrefix + dsName + ConfigSuffix
+}
+
+// MakeHeaderRewriteDotConfig makes the header rewrite file for
+// an Edge hdr_rw_ or Mid hdr_rw_mid_ or Topology hdr_rw_{first,inner,last} file,

Review comment:
       Is this comment correct? It looks like it should be `{first,inner,last}_hdr_rw_`, right? The order presented here suggests a potential conflict with a ds named `inner_`, for example.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org