Proxing name based virtual host

24 views
Skip to first unread message

Sigitas L

unread,
Apr 12, 2016, 5:44:53 AM4/12/16
to OpenLiteSpeed Development
Hello,

I am trying to create a proxy for name based virtual host as described here:


However when I try to access web page browser shows nothing (downloads forever). This happens with 1.4.16 and 1.4.13 versions. With version 1.3.12 I was able to create such setup successfully. 

Maybe something was changed here? Do you have any hints how I could debug this?

Kevin Fwu

unread,
Apr 19, 2016, 9:38:51 AM4/19/16
to OpenLiteSpeed Development
Hi Sigitas,

Apologies for the late response, for whatever reason, I did not see the notification for this.

I am able to reproduce the problem, will let you know when I find out more about this issue.

Cheers,
Kevin

Kevin Fwu

unread,
Apr 19, 2016, 4:18:39 PM4/19/16
to OpenLiteSpeed Development
Hi Sigitas,

Below is the patch that should resolve the issue. Let me know if it works for you.

If you installed via a package manager, it will be part of 1.4.17.

Cheers,
Kevin

diff --git src/http/httpreq.cpp src/http/httpreq.cpp
index 0194162..6d175e1 100644
--- src/http/httpreq.cpp
+++ src/http/httpreq.cpp
@@ -81,7 +81,7 @@ static char *escape_uri(char *p, char *pEnd, const char *pURI, int uriLen)
 {
     const char *pURIEnd = pURI + uriLen;
     char ch;
-    while ((pURI < pURIEnd) && (p < pEnd - 3))
+    while ((pURI < pURIEnd) && (p < pEnd))
     {
         ch = *pURI++;
         if (isalnum(ch))
@@ -106,6 +106,8 @@ static char *escape_uri(char *p, char *pEnd, const char *pURI, int uriLen)
                 *p++ = ch;
                 break;
             default:
+                if (p >= pEnd - 3)
+                    break;
                 *p++ = '%';
                 *p++ = s_hex[((unsigned char)ch) >> 4 ];
                 *p++ = s_hex[ ch & 0xf ];
diff --git src/http/httpsession.cpp src/http/httpsession.cpp
index 720ad6b..7fe4001 100644
--- src/http/httpsession.cpp
+++ src/http/httpsession.cpp
@@ -1328,6 +1328,10 @@ int HttpSession::processVHostRewrite()
             m_sessionHooks.reset();
             m_sessionHooks.inherit(((HttpContext *)pContext)->getSessionHooks(), 0);
             m_pModuleConfig = ((HttpContext *)pContext)->getModuleConfig();
+            if (ret == -2) {
+                m_processState = HSPS_BEGIN_HANDLER_PROCESS;
+                return 0;
+            }
         }
     }
     m_processState = HSPS_CONTEXT_MAP;



On Tuesday, April 12, 2016 at 5:44:53 AM UTC-4, Sigitas L wrote:

Sigitas L

unread,
Apr 20, 2016, 7:12:58 AM4/20/16
to OpenLiteSpeed Development
Hello, 

had a quick test on 1.4.14 - it works as expected now.

Kevin Fwu

unread,
Apr 20, 2016, 8:33:59 AM4/20/16
to OpenLiteSpeed Development
Perfect, thanks for letting me know!

Cheers,
Kevin
Reply all
Reply to author
Forward
0 new messages