httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: http-redirect url gets corrupted in request_rec - apache 2
Date Tue, 11 Dec 2007 17:18:45 GMT

----- Original Message -----
From: Ralf Mattes <>
At: 12/10 18:47:38

On Mon, 2007-12-10 at 12:03 -0700, Joe Lewis wrote:

Yeah, it kind of gets anoying soon ;-)

> Please Stop Top Posting.
> > just finished trying that. Same result still seems to have the same garbage 
characters. Is there any other debugging technique we can try. Can we force 
nulll termination of strings. Are we sure it is a non-null terminated string 
issue, since the characters are occuring in the begining of the string. In the 
past, I think I have noticed them occuring in the middle also ...
> >   
> We are NOT sure whether or not it is a NULL termination issue at this
> point.

Well said.

>   Whatever it is would actually be a result of the variable that
> occurs BEFORE the table in physical memory. 

But we aren't really shure about that, aren't we? Who is actually
setting up that headers-out key/value pair? Maybe the data is already
corrupted when it enters the table? (To the OP: _please_ show us your
code, at least the relevant parts ...).

>  It looks like the first
> segment of the header is getting overwritten.

Hmm, you really think this happens to the actual header being written
out? Maybe it would be a good idea to add some printf- (erm, i mean
ap_log...) style logging to peek at the table value ...

>   You may want to try using
> a debugger at this point, since you had the same results with your
> module hooking to *_LAST.  Using a debugger, you would have to find the
> table header, and then step through while watching that until you see it
> change, then do a back trace to find out where the service is.  (hint,
> in Linux, you would have used "gdb httpd2", then "run -X", then start
> tracing when you hit it with a browser, but in Solaris, I believe you
> will have to use strace or something similar).

I doubt about  strace for Solaris ;-) truss' me. 
But i'd rather have a looong look at the code and examine the place(es)
where the headers are set/modified. 
@OP: can you see a pattern in the garbage? Do you always get the same
bytes at the start of your login? Same _number_ of bytes? 

Rather than using a debugger i'd first use Valgrind or a similar tool 
(maybe even lint, I don't think valgrind is arround on
                                                                       Hi, Forgive me if my
post dosent come out looking right, the mail client Im using is a bit antiquated. However
to answer the above questions, here is a code snippet that illustrates how this is being set
in the code:                 char loc[2024];                                             
                   sprintf (loc, "%s", location);//location is passed into the method    
         apr_table_setn (r->headers_out, "Location", loc);
 return (HTTP_TEMPORARY_REDIRECT);                                              The above
is pretty standard. I also printed out the r->headers_out using apr_table_getn and fprintf
statements and it looks ok. the garbage characters are the same for a given compilation attempt
and apache instance but varies between compilation attempts :-)                          

View raw message