[Xitami] LRWP, CGI and HTTP_REFERER

John Torrance j.torrance at earthlink.net
Mon Jun 26 02:55:50 CEST 2006


Wow, thanks!  I was completely stumped by this about 6 months ago.    I 
have since moved my site to an Apache host since it outgrew my 
DSL/Desktop setup, and that host was passing the complete Referer, but I 
still host a few of my sites on my own machine so this may come in handy 
some day.

John


Paul Osze wrote:

> Okay, looks like I answered my own question.
>
> Xitami does not pass the query string portion of http-referer by design.
>
> From smt/smthttpl.c:
>
>            /*  It's possible that the Referer: field contains an URL
>             *  followed by ? and a whole long argument...  We don't want
>             *  that stuff.  Get rid of it.  (But save it all first.)
>             */
>            if (streq (header_name, "referer")) {
>                mem_strfree (&p_http-> referrer);
>                p_http-> referrer = mem_strdup (header_value);
>                if (strchr (header_value, '?') != NULL)
>                    *strchr (header_value, '?') = '\0';
>            }
>
> To fix this, I just commented out the stripping statement and recompiled:
>
>            /*  It's possible that the Referer: field contains an URL
>             *  followed by ? and a whole long argument...  We don't want
>             *  that stuff.  Get rid of it.  (But save it all first.)
>             */
>            if (streq (header_name, "referer")) {
>                mem_strfree (&p_http-> referrer);
>                p_http-> referrer = mem_strdup (header_value);
>               /*
>                if (strchr (header_value, '?') != NULL)
>                    *strchr (header_value, '?') = '\0';
>               */
>            }
>
> Do this, and you'll be able to get the full HTTP-REFERER url in CGI, 
> PHP, LRWP, etc.
>
> Hope this helps anyone else who's been stumped by this.
>
>
> -- 
> Xitami Users Mailing List -- For Xitami support
> To unsubscribe: http://lists.xitami.org/mailman/listinfo/xitami
>



More information about the Xitami mailing list