I think inside cherokee_connection_get_request, when get_host() tries to manage petitions that are not in the virtual-host table (you have to read the direction from the request and not from Host-header) you are looking for ':' from the end of the request (trying to drop host:port) the problem appears when you need http://host (proxy_http="localhost" wget http://wtf)

It would be enough with a trivial patch like the attached one, but it breaks the 094-URL-request.py :(
    Ok, I tried the configuration tested with the qa:
---
Server request1host {
   Directory /urlrequest1 {
     Handler file
   }
}
---
    And didn't work for me, with and without the patch :S

I have to add the DocumentRoot directive to get it working (with, AND without the patch)
    ideas ?


Index: connection.c
===================================================================
--- connection.c        (revision 238)
+++ connection.c        (working copy)
@@ -902,34 +902,40 @@
 
 static inline ret_t
 get_host (cherokee_connection_t *cnt, 
-         char                  *ptr,
-         int                    size) 
+         char                  *ptr,   
+         int                    size)
 {
        char  *end;
-       char  *end2;
+       char  *i;
        ret_t  ret;
 
-       /* Drop the port if present
-        * Eg: www.alobbs.com:8080 -> www.alobbs.com
+       /* Drop the port if present  
+        * Eg: http://www.alobbs.com:8080 -> www.alobbs.com
         */ 
-       end = end2 = ptr + size;
-       while ((*end2 != ':') && (end2 > ptr)) end2--;
-       if (*end2 == ':') end = end2;
+       
+       end = i = ptr + size;
+       if (strncmp (ptr, "http://";, 7) == 0) {/
+               ptr += 7; 
+       }
+       
+       while ((*i != ':') && (i > ptr)) i--;
+       if (*i == ':') end = i;
 
        /* Sanity check: Is the host name empty?
         */
-       if (unlikely(end - ptr == 0)) return ret_error;
+       if (unlikely(i <= ptr)) return ret_error;
 
        /* Copy the string
         */
        size = (end - ptr);
        ret = cherokee_buffer_add (&cnt->host, ptr, size);
        if (unlikely(ret < ret_ok)) return ret;
 
_______________________________________________
Cherokee mailing list
[email protected]
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee

Reply via email to