perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@cpan.org>
Subject Re: post request truncated
Date Wed, 06 Nov 2002 04:45:22 GMT
On Mon, 2002-11-04 at 06:54, jeroen@one.vthings.net wrote:
> 
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
> 
> When using mod_perl to drive a script that receives a large
> textarea from a html form (using POST), the contents
> of the textarea gets truncated.
> 
> The reason I suspect mod_perl is that I've created a test script
> that just dumps stdin to my browser, using no extra modules (i.e. no CGI.pm)
> 
> When I do that WITHOUT mod_perl the result is:
> - CONTENT_LENGTH: 9737
> - actual read: 9737
> and everything is displayed
> 
> When I do this WITH mod_perl the result is:
> - CONTENT_LENGTH: 9737
> - actual read: 8192
> and the result is only partial. 
> 
> Especially the 'nice' 8k boundary makes me a little suspicous.

Indeed ;-)

> This behavior is very consistent - no matter what browser, no matter I use CGI.pm or
don't, with or without Apache::compat().

there might be something funny going in trying  to use read() on STDIN,
will look at it.

If you look at the code in Apache/compat.pm, sub content {}, you can see
an alternative way to read data from the client. Can you give that
approach a try ?

    my $r = Apache->Request;

    $r->setup_client_block;
    die unless $r->should_client_block;

    my $len = $r->headers_in->get('content-length');
    my $buf;

    #read $len bytes from the client and stuff it in $buf
    $r->get_client_block($buf, $len);


> Perhaps it's a compile option I missed, but in that case it is poorly documented and
I consider it a bug nonetheless.
> 
> The test code is appened at the bottom of this report.
> 
> Browser used for most testing: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021022
> 
> 2. Used Components and their Configuration:
> 
> *** using lib/Apache/BuildConfig.pm
> *** Makefile.PL options:
>   MP_AP_PREFIX   => /usr/local/apache2
>   MP_GENERATE_XS => 1
>   MP_LIBNAME     => mod_perl
>   MP_USE_DSO     => 1
>   MP_USE_STATIC  => 1
> 
> 
> *** /usr/local/apache2/bin/httpd -V
> Server version: Apache/2.0.43
> Server built:   Oct 25 2002 22:37:40
> Server's Module Magic Number: 20020903:0
> Architecture:   32-bit
> Server compiled with....
>  -D APACHE_MPM_DIR="server/mpm/prefork"
>  -D APR_HAS_SENDFILE
>  -D APR_HAS_MMAP
>  -D APR_HAVE_IPV6
>  -D APR_USE_SYSVSEM_SERIALIZE
>  -D APR_USE_PTHREAD_SERIALIZE
>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>  -D APR_HAS_OTHER_CHILD
>  -D AP_HAVE_RELIABLE_PIPED_LOGS
>  -D HTTPD_ROOT="/usr/local/apache2"
>  -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
>  -D DEFAULT_PIDLOG="logs/httpd.pid"
>  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
>  -D DEFAULT_LOCKFILE="logs/accept.lock"
>  -D DEFAULT_ERRORLOG="logs/error_log"
>  -D AP_TYPES_CONFIG_FILE="conf/mime.types"
>  -D SERVER_CONFIG_FILE="conf/httpd.conf"
> 
> 
> *** /usr/bin/perl -V
> Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
>   Platform:
>     osname=linux, osvers=2.4.19-xfs-r1, archname=i686-linux
>     uname='linux cdimage 2.4.19-xfs-r1 #1 smp sat sep 14 17:15:33 local time zone must
be set--see zic i686 authenticamd '
>     config_args='-des -Dprefix=/usr -Darchname=i686-linux -Duselargefiles -Dd_dosuid
-Dlocincpth=  -Dd_semctl_semun -Di_gdbm -Di_db -Di_ndbm'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
>     useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=undef use64bitall=undef uselongdouble=undef
>   Compiler:
>     cc='cc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
>     optimize='-march=i686 -O3 -pipe',
>     cppflags='-fno-strict-aliasing'
>     ccversion='', gccversion='3.2', gccosandvers=''
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
>     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
>     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
>     alignbytes=4, usemymalloc=n, prototype=define
>   Linker and Libraries:
>     ld='cc', ldflags =' -L/usr/local/lib'
>     libpth=/usr/local/lib /lib /usr/lib
>     libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil
>     perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
>     libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
>     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
> 
> 
> Characteristics of this binary (from libperl): 
>   Compile-time options: USE_LARGE_FILES
>   Built under linux
>   Compiled at Oct 21 2002 14:22:04
>   %ENV:
>     PERL_LWP_USE_HTTP_10="1"
>   @INC:
>     /usr/lib/perl5/5.6.1/i686-linux
>     /usr/lib/perl5/5.6.1
>     /usr/lib/perl5/site_perl/5.6.1/i686-linux
>     /usr/lib/perl5/site_perl/5.6.1
>     /usr/lib/perl5/site_perl
>     .
> 
> 
> 3. This is the core dump trace: (if you get a core dump):
> 
>   [CORE TRACE COMES HERE] - no core dump
> 
> This report was generated by t/REPORT on Sun Nov  3 22:05:38 2002 GMT.
> 
> -------------8<---------- End Bug Report --------------8<----------
> 
> Note: Complete the rest of the details and post this bug report to
> dev <at> perl.apache.org. To subscribe to the list send an empty
> email to dev-subscribe@perl.apache.org.
> 
> The dump script I used:
> 
> #---- cut here
> #!/usr/bin/perl
> 
> my $length = $ENV{"CONTENT_LENGTH"};
> 
> my $i = 0;
> print "Content-type: text/html\n\n";
> my $row;
> my $aread = read STDIN,$row,$length;
> 
> print "Total length: $length, actual read is $aread <br>";
> print "START:";
> $row =~ s/%0D%0A/\<br \>/g;
> print $row;
> print "STOP:";
> #--- cut here
> 
> The html form I used:
> #--- cut here
> <html>
> <form name="main" action="/dump" method="post">
> <textarea name="text" wrap="virtual" rows="17" cols="70" style="width: 99%">
> </textarea>
> <input type="submit" value="submit" />
> </form>
> </html>
> #--- cut here
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
> 
> 


Mime
View raw message