https://issues.shibboleth.net/jira/browse/CPPXT-97
authorScott Cantor <cantor.2@osu.edu>
Fri, 9 Jan 2015 03:25:56 +0000 (03:25 +0000)
committerScott Cantor <cantor.2@osu.edu>
Fri, 9 Jan 2015 03:25:56 +0000 (03:25 +0000)
xmltooling/io/HTTPResponse.cpp

index 29623cc..94c1aef 100644 (file)
@@ -95,14 +95,18 @@ void HTTPResponse::setCookie(const char* name, const char* value)
 
 void HTTPResponse::setResponseHeader(const char* name, const char* value)
 {
-    for (const char* ch=name; *ch; ++ch) {
-        if (iscntrl(*ch))
-            throw IOException("Response header name contained a control character.");
+    if (name) {
+        for (const char* ch=name; *ch; ++ch) {
+            if (iscntrl(*ch))
+                throw IOException("Response header name contained a control character.");
+        }
     }
 
-    for (const char* ch=value; *ch; ++ch) {
-        if (iscntrl(*ch))
-            throw IOException("Value for response header ($1) contained a control character.", params(1,name));
+    if (value) {
+        for (const char* ch=value; *ch; ++ch) {
+            if (iscntrl(*ch))
+                throw IOException("Value for response header ($1) contained a control character.", params(1,name));
+        }
     }
 }