Signal 6 is segmentation violation. Most likely you are overwriting memory.
Yep.. you do not ensure there is sufficient space in log_uri. This is
allocated just large enought to fit the logged URL with no extra headroom for
later modifications of the string. Also you have broken the if (valid) code
flow.. (missing curly brakets)
The correct code for updating http->log_uri while processing a request reads
safe_free(http->log_uri);
http->log_uri = xstrdup(the_new_url);
And should be done in clientRedirectDone (client_side.c) where all the other
parsing of redirector results take place.
Regards
Henrik
KRATKY, Andrej wrote:
> Hello Henrik,
>
> as seen in devel.squid-cache.org, you are responsible for reverse proxy
> functionality enhancements. I am using squid in reverse proxy mode with own
> rewriter and need an enhancement which would add an info into access log
> from external rewriter program. So I would like to ask you kindly for a
> help.
>
> Example:
> - input URL (to externel rewriter): http://www.something.com/abcd.cgi?ab=1
> - output URL (from externel rewriter):
> http://www2.something.com/abcd.cgi?ab=1|my_additional_info
>
> The part starting from '|' should be together with input URL written into
> access log and output URL without part behind '|' should be requested from
> the given server (www2). The adjustment I added into redirector.c is
> coloured in added source.
>
> It seems to be working, but after few requests squid goes down with signal
> 6: Oct 22 16:48:50 ev2 squid[15893]: Squid Parent: child process 15895
> exited due to signal 6 Oct 22 16:48:53 ev2 squid[15893]: Squid Parent:
> child process 15934 started
>
> Would you have a minute to help me resolve this problem?
>
> Thanx for a reply
>
> With Best Regards
>
> Andrej Kratky
>
>
>
> ##############################################################
> # redirect.c - redirectHandleReply()
> ##############################################################
>
> static void
> redirectHandleReply(void *data, char *reply)
> {
> redirectStateData *r = data;
> int valid;
> char *t;
> debug(29, 5) ("redirectHandleRead: {%s}\n", reply ? reply : "<NULL>");
> if (reply) {
> if ((t = strchr(reply, ' ')))
> *t = '\0';
> if (*reply == '\0')
> reply = NULL;
> }
> valid = cbdataValid(r->data);
> cbdataUnlock(r->data);
>
> if (valid)
> // Hack to keep URL note in log not in outgoing URL
> if (NULL!=strstr(reply,"|")) {
> strncat(((clientHttpRequest
> *)(r->data))->log_uri,strstr(reply,"|"),(MAX_URL-5-strlen(((clientHttpReque
>st *)(r->data))->log_uri))); *strstr(reply,"|")='\0';
> }
> // Hack END [Andrej 21.10.2002]
> r->handler(r->data, reply);
> redirectStateFree(r);
> }
Received on Tue Oct 22 2002 - 12:07:38 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:59 MST