elsloo closed pull request #2146: [Issue 2096] Fix TR issue with capital 
letters in CDN domain. fixes #2096
URL: https://github.com/apache/incubator-trafficcontrol/pull/2146
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/traffic_ops/traffic_ops_golang/cdn/cdns.go 
b/traffic_ops/traffic_ops_golang/cdn/cdns.go
index 06c381aae..ac07497fa 100644
--- a/traffic_ops/traffic_ops_golang/cdn/cdns.go
+++ b/traffic_ops/traffic_ops_golang/cdn/cdns.go
@@ -136,6 +136,8 @@ func (cdn *TOCDN) Create(db *sqlx.DB, user 
auth.CurrentUser) (error, tc.ApiError
                log.Error.Printf("could not begin transaction: %v", err)
                return tc.DBError, tc.SystemError
        }
+       // make sure that cdn.DomainName is lowercase
+       *cdn.DomainName = strings.ToLower(*cdn.DomainName)
        resultRows, err := tx.NamedQuery(insertQuery(), cdn)
        if err != nil {
                if pqErr, ok := err.(*pq.Error); ok {
@@ -243,6 +245,8 @@ func (cdn *TOCDN) Update(db *sqlx.DB, user 
auth.CurrentUser) (error, tc.ApiError
                return tc.DBError, tc.SystemError
        }
        log.Debugf("about to run exec query: %s with cdn: %++v", updateQuery(), 
cdn)
+       // make sure that cdn.DomainName is lowercase
+       *cdn.DomainName = strings.ToLower(*cdn.DomainName)
        resultRows, err := tx.NamedQuery(updateQuery(), cdn)
        if err != nil {
                if pqErr, ok := err.(*pq.Error); ok {
diff --git 
a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java
 
b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java
index d706e28fb..ea17db058 100644
--- 
a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java
+++ 
b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java
@@ -353,12 +353,12 @@ private void parseCacheConfig(final JsonNode 
contentServers, final CacheRegister
                                                        if (dso != null && 
dso.size() > 0) {
                                                                int i = 0;
                                                                for (final 
JsonNode nameNode : dso) {
-                                                                       final 
String name = nameNode.asText().toLowerCase();
+                                                                       final 
String name = nameNode.asText();
                                                                        if (i 
== 0) {
                                                                                
references.add(new DeliveryServiceReference(ds, name));
                                                                        }
 
-                                                                       final 
String tld = JsonUtils.optString(cacheRegister.getConfig(), 
"domain_name").toLowerCase();
+                                                                       final 
String tld = JsonUtils.optString(cacheRegister.getConfig(), "domain_name");
 
                                                                        if 
(name.endsWith(tld)) {
                                                                                
final String reName = name.replaceAll("^.*?\\.", "");


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to