You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Paul <yd...@yahoo.com> on 2000/11/07 17:10:49 UTC

[repost]garbled redirects

Hi all.

A while back I posted a similar problem.  My error logs have frequent
entries showing erroneous redirect strings, like this:

[Tue Nov  7 08:57:45 2000] [error] [client 90.14.50.41] Invalid error
redirection directive: ��@

Sometimes *most* of the redirect is fine; I found one where nothing was
garbled but the protocol -- instead of "https" it had several binary
characters, but from the :// on the address was fine. Here's one:

[Tue Nov  7 09:05:56 2000] [error] [client 96.80.9.46] Invalid error
redirection �xs://buda.bst.bls.com/dres/dres.cgi

What would cause that?
It's a secure intranet, btw -- you have to be inside the company
firewall to hit it.

That "s" is probably valid -- it's an Perl*Handler in mod_perl that's
checking requests, and routing those to restricted parts of the server
to the secure protocol. It was easier than wading through the
mod_rewrite docs. ~sheepish grin~ Still, it's a simple handler, and
works other than this occasional glitch. In the hopes that I'm not
providing too *much* info, here's the handler code (minimally edited):

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# module for Apache/mod_perl PerlPostReadRequestHandler to redirect
# users on the nonsecure port over to SSL (hopefully saving bookmarks)
#______________________________________________________________________

package Apache::PortCorrect;

use strict;
use Apache::Constants qw( :response :methods );

sub handler {
     my($r,$s,$url,$args,$uri,$subr);
     $r = shift;        # the request object
     return OK if 443 == $r->get_server_port;
     (undef,$url,undef) = split(/\s+/o, $r->the_request);
     return OK if $url =~ m{ ^(?:/                  # allow home
                           | .*[.](?:gif|jpg)       # graphics ok
                           | /(?:list|of|open|dirs).* # inefficient...
                           | /(?:home|cook)[.]shtml # special cases
                              )$
                           }ixo;
     $uri = "https://buda.bst.bls.com" . $url;   
     $uri .= "?$args" if $args = $r->args;          
     $r->custom_response(MOVED,$uri);
     return MOVED;
}

1; # guarantee return code for load

#______________________________________________________________________

Also, I'm still having *constant* segfaults for no reason I can tell:

[Tue Nov  7 09:03:41 2000] [notice] child pid 8201 exit signal
Segmentation fault (11)
[Tue Nov  7 09:05:56 2000] [error] [client 96.80.9.46] Invalid error
redirection �xs://buda.bst.bls.com/dres/dres.cgi
[Tue Nov  7 09:06:23 2000] [notice] child pid 2176 exit signal
Segmentation fault (11)
[Tue Nov  7 09:06:27 2000] [notice] child pid 13445 exit signal
Segmentation fault (11)
[Tue Nov  7 09:06:39 2000] [notice] child pid 16884 exit signal
Segmentation fault (11)
[Tue Nov  7 09:10:15 2000] [error] [client 90.17.208.181] Invalid error
redirection directive: 
[Tue Nov  7 09:11:23 2000] [notice] child pid 8158 exit signal
Segmentation fault (11)
[Tue Nov  7 09:15:33 2000] [notice] child pid 18409 exit signal
Segmentation fault (11)
[Tue Nov  7 09:15:33 2000] [notice] child pid 17990 exit signal
Segmentation fault (11)
[Tue Nov  7 09:15:57 2000] [notice] child pid 27829 exit signal
Segmentation fault (11)
[Tue Nov  7 09:15:59 2000] [notice] child pid 18001 exit signal
Segmentation fault (11)
[Tue Nov  7 09:16:01 2000] [notice] child pid 18817 exit signal
Segmentation fault (11)
[Tue Nov  7 09:24:33 2000] [notice] child pid 17962 exit signal
Segmentation fault (11)
[Tue Nov  7 09:24:35 2000] [notice] child pid 16004 exit signal
Segmentation fault (11)
[Tue Nov  7 09:24:38 2000] [notice] child pid 18008 exit signal
Segmentation fault (11)
[Tue Nov  7 09:26:46 2000] [notice] child pid 17928 exit signal
Segmentation fault (11)
[Tue Nov  7 09:26:59 2000] [notice] child pid 17993 exit signal
Segmentation fault (11)
[Tue Nov  7 09:42:34 2000] [notice] child pid 19186 exit signal
Segmentation fault (11)
[Tue Nov  7 09:42:42 2000] [notice] child pid 19187 exit signal
Segmentation fault (11)

The server is serving, but sometimes we get a string of timeouts or
"document contained no data" errors (which I'm *assuming*....yeah, I
know...are the results of segfaults.)

Anybody else out there using HP-UX B.10.20? 
An old HP 9000/891 midrange?

If it matters, I'm running:
Server: Apache/1.3.12 (Unix) mod_perl/1.23 mod_ssl/2.6.4 OpenSSL/0.9.5a
Server compiled with....
 -D EAPI
 -D HAVE_SHMGET
 -D USE_SHMGET_SCOREBOARD
 -D USE_FCNTL_SERIALIZED_ACCEPT
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
 -D DEFAULT_LOCKFILE="logs/httpd.lock"
 -D DEFAULT_XFERLOG="logs/access_log"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 -D ACCESS_CONFIG_FILE="conf/access.conf"
 -D RESOURCE_CONFIG_FILE="conf/srm.conf"

Summary of my perl5 (revision 5.0 version 6 subversion 0)
configuration:
  Platform:
    osname=hpux, osvers=10.20, archname=PA-RISC1.1-multi
    uname='hp-ux uap5 b.10.20 c 9000891 373319211 32-user license '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef    
usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef    
usesocks=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-D_HPUX_SOURCE -Aa -DDEBUGGING'
    ccflags =' -D_HPUX_SOURCE -DDEBUGGING -D_LARGEFILE_SOURCE          
                    -D_FILE_OFFSET_BITS=64  -Ae'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
       lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lnsl_s -lndbm -ldld -lm -lc -lndir -lcrypt -lsec
    libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E    
-Wl,-B,deferred '
    cccdlflags='+z', lddlflags='-b +vnocompatwarnings -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING MULTIPLICITY USE_LARGE_FILES         
               PERL_IMPLICIT_CONTEXT
  Built under hpux
  Compiled at May  5 2000 15:36:16
  @INC:
    /usr/local/lib/perl5/5.6.0/PA-RISC1.1-multi
    /usr/local/lib/perl5/5.6.0
    /dart10/perl5/lib/site_perl/PA-RISC1.1-multi
    /dart10/perl5/lib/site_perl
    /dart10/perl5/lib/site_perl
    .


(Sorry, I don't have utilities for a decent stacktrace....)

As always, thanks much in advance for any suggestions.

Paul

__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one Place.
http://shopping.yahoo.com/

Re: [repost]garbled redirects

Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 7 Nov 2000, Paul wrote:

> Hi all.
> 
> A while back I posted a similar problem.  My error logs have frequent
> entries showing erroneous redirect strings, like this:
> 
> [Tue Nov  7 08:57:45 2000] [error] [client 90.14.50.41] Invalid error
> redirection directive: ��@
> 
> Sometimes *most* of the redirect is fine; I found one where nothing was
> garbled but the protocol -- instead of "https" it had several binary
> characters, but from the :// on the address was fine. Here's one:
> 
> [Tue Nov  7 09:05:56 2000] [error] [client 96.80.9.46] Invalid error
> redirection �xs://buda.bst.bls.com/dres/dres.cgi
> 
> What would cause that?

the problem is with $r->custom_response().  if there are no ErrorDocuments
configured, it would allocate the table from r->pool, but the table needs
to live longer than r->pool, eek!  patch below will fix.  seems apache.org
sshd is down, so i can't commit yet.

--- src/modules/perl/Apache.xs~ Thu Dec 21 22:44:52 2000
+++ src/modules/perl/Apache.xs  Thu Dec 21 22:45:30 2000
@@ -247,7 +247,7 @@
 
     if(conf->response_code_strings == NULL) {
         conf->response_code_strings = (char **)
-         pcalloc(r->pool,
+         pcalloc(perl_get_startup_pool(),
              sizeof(*conf->response_code_strings) * 
              RESPONSE_CODES);
     }