filter_http_rewrite: don't crash if "Host" header is missing
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 1 Jul 2013 14:20:54 +0000 (16:20 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 1 Jul 2013 14:20:54 +0000 (16:20 +0200)
src/filter_http_rewrite.cpp

index bb03d67..d417f46 100644 (file)
@@ -156,8 +156,12 @@ void yf::HttpRewrite::Phase::rewrite_reqline (mp::odr & o,
     else
     {
         //TODO what about proto
+        const char *host = z_HTTP_header_lookup(hreq->headers, "Host");
+        if (!host)
+            return;
+
         path += "http://";
-        path += z_HTTP_header_lookup(hreq->headers, "Host");
+        path += host;
         path += hreq->path;
     }