Antwort: Re: [Apache::AuthenNTLM] Performance Probs

2002-10-23 Thread Frank . Zimper
Hello,

 I recently installed Apache::AuthenNTLM 0.21 on a Solaris 8 box running
 Apache 1.3.26 with mod_perl. The trouble is now that the response times
 are sometimes very slow, up to several tens of seconds. They are faster
 with non-NTLM-browsers like Mozilla, in this case it's only the first
 request that's painfully slow. The subsequent ones are ok.

 Has someone an idea how I can improve the performance on this?


Looks like that it gets slow when the AuthenNTLM needs to ask the windows
domain controller if the user/password is ok.

That could either be some dns lookup problems or network or windows
performance problems.

The ping statistics look like this:

 SXPDC PING Statistics
308 packets transmitted, 308 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 0/0/0

Not too slow I suppose ;-)

I can't use nslookup as I had to declare the Windows servers in /etc/hosts


The other thing is you have configurated

 PerlSetVar defaultdomain eeu
 PerlSetVar fallbackdomain eeu

but no definition for domain eeu, you shoudl add something like
I have definitions for the necessary resource domains as well as the 
Master Account Domains involved in the configuration file.
I only stripped them in the example.

I just tried to reproduce those very slow connections but it's like 
always: When you want it to happen, it doesn't (Does anyone know a good 
English word for Vorführeffekt?).
As soon as I can reproduce it I'll extract the relevant part of the 
err_log file and post it.

Another problem I experience since the switch to Apache::AuthenNTLM is 
with POST-Forms. Some of them simply don't pass their parameters to the 
mod_perl-Script. Except when I restart the webserver before submitting the 
form. Any ideas on this?




Re: Antwort: Re: [Apache::AuthenNTLM] Performance Probs

2002-10-23 Thread Gerald Richter - ecos gmbh
As soon as I can reproduce it I'll extract the relevant part of the
err_log file and post it.

Ok, I looking forward to it...

Another problem I experience since the switch to Apache::AuthenNTLM is
with POST-Forms. Some of them simply don't pass their parameters to the
mod_perl-Script. Except when I restart the webserver before submitting the
form. Any ideas on this?

This is a bug (not sure if it's in AuthenNTLM or IE). It does only occurs on
some clients, while other seems to work. I currently working on it to fix
it.

Gerald


-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-







Re: Problems writing binary uploaded data...

2002-10-23 Thread Leif Snorre Schøyen Boasson
I've (Or rather Issac, on the list) sorted it out - I simply forgot to
close the file after writing it... pretty silly :)

cheers
Snorre

On Wed, 23 Oct 2002 [EMAIL PROTECTED] wrote:


 Hmm, I've tried your code on my system and it does exactly what it's supposed
 to. I get the same filesizes reported at the destination end and in the script
 as the file is on my PC HDD.

 Have you tried a different file ? Do you always loose the same amount ?

 Cheers

 Paul



 ***
 Important.
 Confidentiality: This communication is intended for the above-named person and
 may be confidential and/or legally privileged. Any opinions expressed in this
 communication are not necessarily those of the company. If it has come to you
 in error you must take no action based on it, nor must you copy or show it to
 anyone; please delete/destroy and inform the sender immediately.

 Monitoring/Viruses
 Orange may monitor all incoming and outgoing emails in line with current
 legislation.  Although we have taken steps to ensure that this email and
 attachments are free from any virus, we advise that in keeping with good
 computing practice the recipient should ensure they are actually virus free.

 Orange PCS Limited is a subsidiary of Orange SA and is registered in England No
 2178917, with its address at St James Court, Great Park Road, Almondsbury Park,
 Bradley Stoke, Bristol BS32 4QJ.
 ***





very OT: english/german -- was Re: Antwort: Re:[Apache::AuthenNTLM] Performance Probs

2002-10-23 Thread Mrs. Brisby

 always: When you want it to happen, it doesn't (Does anyone know a good 
 English word for Vorführeffekt?).

Sod's Law (British) or Murphy's Law (American English) are pretty close.
1. In any situation, if something can go wrong, it will go wrong.
2. In any situation, even if nothing can go wrong, it will still go
wrong.
3. When you haven't planned to get into a situation where Sod's Law
could do anything that could possibly bother you in the slightest, Sod's
law dictates it will bugger up someone else's day, which will
inadvertently ruin your day as well. 

But I don't think it counts. Sod's Law is more of a joke- a thought
game. I don't think there's a good English-y word (or words) for
Vorfuhreffekt. The fish says Demonstration Failure or Demonstrating
Effect - neither of which cuts it.

It's a good word, and I have heard it suggested that it be adopted into
English but we all know that while the English language will admit a
word like Doh - the contestants on Wheel Of Fortune wouldn't ever be
able to pronounce it without sounding much like a rhinoceros fornicating
with a steel shed.

However, Yiddish has several inflection-rules (if you can call them
that) that were borrowed into English. Probably because it sounds funny.
It's a bit difficult to properly connote this in-type, but we can try:

Well, it _was_ doing it!

And finally, as the field circus says: If it happens again, reinstall.




IPC suggestions sought/talking between children?

2002-10-23 Thread Bas A . Schulte
Hi all,

I'm looking for some suggestions on a problem I'm looking at. I have a 
mod_perl handler running that sends out certain push messages (could be 
e-mail, could be an http post etc.) for several customers that are 
identified by a unique identifier.

Examples:

http://my.server.com/myhandler?target=customerAdata=sendthis

http://my.server.com/myhandler?target=customerBdata=sendthat

Now what I want to do is restrict the number of concurrent running 
requests per customer. For example, if 5 apache children are running my 
handler on behalf of customer A, I want my handler to do something else 
with a new request for customer A. I don't want to throw away the 6th 
request but slap it in some queue for later processing.

I looked at mod_throttle and similar offerings but they tend to throw 
away requests when there are too many concurrent requests or when 
bandwidht is higher than some defined max.. That's not what I want.

What I really need is some form of IPC between apache children so one 
child can find out what other children are currently doing.

I've been thinking about IPC::Shareable but I have had some bad 
experience with it (longish ago though).

Anyone got some pointers for me to look at? Is there something hidden in 
the Apache API that I might use from mod_perl?

Regards,

Bas.




[newbie] How do I send a custom HTTP::Response?

2002-10-23 Thread Chris Pizzo

The documentation tells me how to create a new response object but how do I
reply to a request using my custom response?

Thanks,
Chris




Re: [newbie] How do I send a custom HTTP::Response?

2002-10-23 Thread Perrin Harkins
Chris Pizzo wrote:

The documentation tells me how to create a new response object but how do I
reply to a request using my custom response?


HTTP::Response?  That's an LWP thing, not a mod_perl thing.  Maybe 
you're a little confused here?  Tell us what you're trying to do.

- Perrin



Re: [newbie] How do I send a custom HTTP::Response?

2002-10-23 Thread Chris Pizzo
OK,  I am getting a request from a server and I need to respond with an XML
doc.


- Original Message -
From: Perrin Harkins [EMAIL PROTECTED]
To: Chris Pizzo [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, October 23, 2002 12:54 PM
Subject: Re: [newbie] How do I send a custom HTTP::Response?


 Chris Pizzo wrote:
  The documentation tells me how to create a new response object but how
do I
  reply to a request using my custom response?

 HTTP::Response?  That's an LWP thing, not a mod_perl thing.  Maybe
 you're a little confused here?  Tell us what you're trying to do.

 - Perrin






Re: [newbie] How do I send a custom HTTP::Response?

2002-10-23 Thread Perrin Harkins
Chris Pizzo wrote:

OK,  I am getting a request from a server and I need to respond with an XML
doc.


So your mod_perl handler is getting an HTTP request and you want to send 
back an XML document?  No problem, just send it.  Set the content-type 
if you need to.  There's no trick to it.  See the mailing list archives 
for more on this.

- Perrin



code evaluation in regexp failing intermittantly

2002-10-23 Thread Rodney Hampton
Please bear with me.  I have a really weird question.  Let me preface it 
by stating that I'm building a very simple templating application.  I 
asked on perlmonks whether or not code evaluation in regexp is going to 
be deprecated and the answer I got was that this feature wasn't going 
away.  I've scripted a regexp that basically takes % link_name 
template_faq % and replaces this with a 
href=/?q_act=viewq_srn=12template_faq/a
where template_faq is the name of the template and 12 is the template id 
in the database.  Pretty simple.

Next, I did something else pretty cool IMHO, and made it possible to do 
% img_src_name some_image % and have it replace this with
the approrpiate img src= height= width=  tag thanks to a little 
magic from Image::Size.

Not satisfied, I wanted to make it possible to do something like:
% code_ref Util::Test_Util::test_expand %
and have it swap in the text output from the sub into the template. 
That way, unlike other templating applications, I could get away from 
writing my own mini language and use the full power of perl in a sub 
called by a simple tag in the template.  I only need to make sure that 
these code subroutines always return an expected set of values to 
indicate success or failure -- in other words, never call die in the 
subroutine.  

All of this stuff works flawlessly from the command line (see 
test_parse.pl attached).
And it works in mod_perl, but only sometimes.  I've pulled down output 
using lynx, wget, Mozilla, Konquerer, and IE.  I've made sure no content 
caching is occurring.  After shoving a few print STDERR in my 
perlHandler View.pm (also attached), I've found that it is as if 
mod_perl is ignoring the
code evaluation regexp from time to time.  Sometimes it does it, 
sometimes not.

I can provide logs to substantiate this.  I'm at a loss for why mod_perl 
would do this.  I had thought garbage collection might be failing on my 
$file variable but I've explicitly undefined it in the handler and still 
nada.

Please forgive the beta quality of the code, but I'm just trying to get 
this to work.  I'll pretty it up and break it into subs later.

My environment is thus:
Apache/1.3.26 (Unix) mod_perl/1.27 PHP/4.2.3
RedHat Linux 7.3 kernel 2.4.18-10
Dell Latitude Notebook
I can provide compile options I used to build apache, mod_perl, mod_ssl, 
and php if this is necessary.

Can any of you gurus please help!





Rodney Hampton






package Application::View;

#PerlHandler
###
# Copyright (C) 2000-2002  R.A. Hampton and Associates
# All Rights Reserved.  Proprietary and Confidential.
#==
# $Id: View.pm,v 1.21 2002/10/23 08:01:54 rhampton Exp $
#--
# Tag:         $Name:  $
# Revision:    $Revision: 1.21 $
# Date:        $Date: 2002/10/23 08:01:54 $
# Author:      $Author: rhampton $
# Description:

use strict;
use Apache::Constants   qw/ :common /;
use Util::Constants qw/ :errors /;
use Util::Parse_Handler qw/ ph_parse_input ph_abort /;
use Util::Outputqw/ expandStruct /;#necessary for code_ref eval
use Rendering::Common qw/ common_html_header common_html_footer common_session_utility 
common_return_rendering_object/;
use Disk::Disk_Object_Read; #read-only disk object
use Business_Logic::User_Object;
use Business_Logic::Item_Object;
use IO::File;
use Image::Size qw/ html_imgsize /;
use Safe;

## BEGIN handler
sub handler {
my $r = shift;

##BEGIN figure out if we are under /ceoadmin or /advertiser so we can react 
accordingly later
my $code;
my $href;
my $ceoadmin_flag=0;
my $advertiser_flag=0;
my $action = $r-uri;
#must strip of the leading slash
$action =~ s/^\///;
my ( $type, directions ) = (split /\//, $action);
if ($type eq 'ceoadmin'){$ceoadmin_flag=1;}
if ($type eq 'advertiser'){$advertiser_flag=1;}
##END figure out if we are under /ceoadmin or /advertiser so we can react 
accordingly later

##BEGIN parse inputs
my ($input,$msg_i) = ph_parse_input (
r   = $r, 
args_list = ['q_act','q_srn'],
);

unless($input) {
ph_abort($r,Error parsing http arguments:,$msg_i);
return DONE;
}
##END parse inputs

##BEGIN instantiate disk_object_read - database handle comes along for the ride
my 
($disk_object,$disk_object_error)=Disk::Disk_Object_Read-new();#file_id not 
identified at this point, but that is ok
if($disk_object_error){

Re: code evaluation in regexp failing intermittantly

2002-10-23 Thread Ged Haywood
Hi there,

On Wed, 23 Oct 2002, Rodney Hampton wrote:

 Sometimes it does it, sometimes not.

Have a look in the mod_perl Guide.  You'll find it if you look at
the mod_perl home page, http://perl.apache.org

There's a section called Sometimes it works. sometimes it doesn't.
I'm not telling you exactly where to find it because I want you to
read the whole thing. :)

73,
Ged.

PS: Do you think you could make the posts a bit shorter?
I nearly didn't read it at all...




Re: code evaluation in regexp failing intermittantly

2002-10-23 Thread Ed
On Wed, Oct 23, 2002 at 02:24:48PM -0500, Rodney Hampton wrote:
 
 Can any of you gurus please help!
 

A wise guru would help by directing you to:
http://perl.apache.org/docs/tutorials/tmpl/comparison/comparison.html



RE: MySQL default max_connections

2002-10-23 Thread Jesse Erlbaum
Hi Bas --

 After some digging around it appears that MySQL default max. number of
 connections is 100, no matter how much RAM you stuck in your server! So
 even though I had no real problems with my webservers, MySQL didn't
 allow new connections.

Every database server has a configurable limit on connections.  (For that
matter, so does Apache!)  The limits are to prevent a run-away process from
taking down the server.

FWIW, I've configured MySQL to accept as many as 2000 concurrent connections
without a problem.  MySQL simply rocks.

Warmest regards,

-Jesse-


--

  Jesse Erlbaum
  The Erlbaum Group
  [EMAIL PROTECTED]
  Phone: 212-684-6161
  Fax: 212-684-6226




Re: code evaluation in regexp failing intermittantly

2002-10-23 Thread Rodney Hampton
Thanks to some help, the answer was simply to enclose all my code 
evaluation regexp statements with eval q{}; (strangely, even those 
within an eval block already needed this same kick in the pants)
I think I'm back on track now.  Sorry for the lengthy post.

Regards,



Rodney Hampton

Rodney Hampton wrote:

 
And it works in mod_perl, but only sometimes.  I've pulled down output 
using lynx, wget, Mozilla, Konquerer, and IE.  I've made sure no 
content caching is occurring.  After shoving a few print STDERR in my 
perlHandler View.pm (also attached), I've found that it is as if 
mod_perl is ignoring the code evaluation regexp from time to time.  
Sometimes it does it, sometimes not.







Problems compiling mod_perl1.27 under IRIX64...

2002-10-23 Thread DeAngelo Lampkin
 Hi guys,
 
 I've searched mail-list archives and seen this question asked, but I've never found 
the answer.  
 
 Whenever I try to compile mod_perl1.27 on SGI IRIX64 I get the following error 
message at the end of the make process:
 
  Error Output for sanity check 
 cd ..; cc -n32  -DIRIX -DMOD_PERL -DUSE_PERL_SSI -D_BSD_TYPES -D_BSD_TIME 
-woff 1009,1110,1174,1184,1552 -OPT:Olimit=0 -DLANGUAGE_C -DUSE_HSREGEX 
-DNO_DL_NEEDED -D_BSD_TYPES -D_BSD_TIME -woff 1009 1110 1174 1184 1552 -OPT:Olimit=0 
-DLANGUAGE_C `./apaci` -I. -I/usr/local/lib/perl5/5.6.1/IP27-irix/CORE-o 
helpers/dummy helpers/dummy.c   -L/usr/local/lib32 -L/usr/local/lib -Wl,-woff,84 
/usr/local/lib/perl5/5.6.1/IP27-irix/auto/DynaLoader/DynaLoader.a 
-L/usr/local/lib/perl5/5.6.1/IP27-irix/CORE -lperl -lm -lc
 ld32: FATAL 9: I/O error (1110): No such file or directory
 *** Error code 2 (bu21)
 = End of Error Report =
 
 All of the directories listed are present.
 Anyone familiar with this error and/or know the solution (or possible solution)?  
Please help me maintain my sanity. :)
 
 Thanks!
 
 DeAngelo Lampkin
 Xencor
 626 - 737 - 8083
  
 



Re: code evaluation in regexp failing intermittantly

2002-10-23 Thread Perrin Harkins
Rodney Hampton wrote:

Let me preface it 
by stating that I'm building a very simple templating application.
[...]

Not satisfied, I wanted to make it possible to do something like:
% code_ref Util::Test_Util::test_expand %
and have it swap in the text output from the sub into the template. That 
way, unlike other templating applications, I could get away from writing 
my own mini language and use the full power of perl in a sub called by a 
simple tag in the template.

Do you realize that almost every templating system on CPAN already does 
this?  If you are doing this because you think you've hit on a new 
feature, stop now and download one of those.  If you're doing it because 
hacking perl is fun and you're in no rush, then go ahead and have a good 
time.

- Perrin




Re: code evaluation in regexp failing intermittantly

2002-10-23 Thread Danny Rathjens
Very useful document comparing templating systems:

  http://perl.apache.org/docs/tutorials/tmpl/comparison/comparison.html

Especially the funny debate between mini-lang and in-line, 8^)

Perrin Harkins wrote:

Rodney Hampton wrote:


Let me preface it by stating that I'm building a very simple 
templating application.

[...]


Not satisfied, I wanted to make it possible to do something like:
% code_ref Util::Test_Util::test_expand %
and have it swap in the text output from the sub into the template. 
That way, unlike other templating applications, I could get away from 
writing my own mini language and use the full power of perl in a sub 
called by a simple tag in the template.

Do you realize that almost every templating system on CPAN already does 
this?  If you are doing this because you think you've hit on a new 
feature, stop now and download one of those.  If you're doing it because 
hacking perl is fun and you're in no rush, then go ahead and have a good 
time.

- Perrin
--
 _.,-*~`^'~*-,._ Danny Rathjens _.,-*~`^'~*-,._
FireCast: Rock solid kiosk software: http://wirespring.com




Random broken images when generating dynamic images

2002-10-23 Thread Dave Rolsky
So here's the situation.

I have some code that generates images dynamically.  It works, mostly.

Sometimes the image will show up as a broken image in the browser.  If I
reload the page once or twice, the image comes up fine.

On a page with 5 different dynamic images (all generated by the same chunk
of code, it's a set of graphs), I'll often see 1 or 2 as a broken image,
but the rest work.  Sometimes all 5 are ok.

I tried out a scheme of writing them to disk with dynamically generated
files, but since I still need to do some auth checking, they end up being
served dynamically and I have the same problem.

To make it even weirder, I just took a look at one of the image files that
showed up as broken, and it's fine (I can't view it directly in my
browser).

I can't for the life of me figure out what the heck is going on.  It seems
that the image data is just fine.  Could the browser be timing out for
some reason?

This has been seen in multiple browsers too (Galeon and IE, at least) so
it's not browser-specific.

I'd love to fix the root cause, but a workaround would be fine too.  The
fundamental problem is that there's no way to not have some code involved
in this process because there needs to be some auth checking before the
image is served.

Any help would be much appreciated.


-dave

/*==
www.urth.org
we await the New Sun
==*/




Re: Random broken images when generating dynamic images

2002-10-23 Thread Dave Rolsky
On Wed, 23 Oct 2002, Dave Rolsky wrote:

 I have some code that generates images dynamically.  It works, mostly.

 Sometimes the image will show up as a broken image in the browser.  If I
 reload the page once or twice, the image comes up fine.

I should mention that I'm using Mason, and I haven't yet tried playing
with a non-Mason based solution, but I am making sure to clear Mason's
buffers before serving the image, and I abort the (Mason) request
immediately after the image data is sent, so I don't think Mason is
causing the problem.


-dave

/*==
www.urth.org
we await the New Sun
==*/




Re: Random broken images when generating dynamic images

2002-10-23 Thread Ed
On Wed, Oct 23, 2002 at 05:55:05PM -0500, Dave Rolsky wrote:
 So here's the situation.
 
 I have some code that generates images dynamically.  It works, mostly.
 
 Sometimes the image will show up as a broken image in the browser.  If I
 reload the page once or twice, the image comes up fine.
 
 On a page with 5 different dynamic images (all generated by the same chunk
 of code, it's a set of graphs), I'll often see 1 or 2 as a broken image,
 but the rest work.  Sometimes all 5 are ok.
 
 I tried out a scheme of writing them to disk with dynamically generated
 files, but since I still need to do some auth checking, they end up being
 served dynamically and I have the same problem.
 
 To make it even weirder, I just took a look at one of the image files that
 showed up as broken, and it's fine (I can't view it directly in my
 browser).

I've seen the problem before.  My solution was to save the dynamic images
on disk and serve them just like plain 'ol static files from the front-end
server. This way everything is served from the same Keep-Alive request.
And apache does all the http/1.1 headers/chunked-encoding for me.

Your MaxKeepAliveRequests would then be the culprit on your end but not likely
unless its set really low.  I'm not sure how the browser determines the
equivalent limit. tcpdump showed that opera created a second keep-alive
request after 10 images for me (could be limiting on bytes rather than
requests ... don't know).

You can still serve dynamicly and handle the custom auth w/ the backend and
maintain the clients keep-alive.  The current mod_proxy will maintain the
clients keep-alive eventhough your backend has keepalive off.  Be sure
all the required http/1.1 components/headers are sent to maintain a
keep-alive.

I'm interested in what you finally work out.

thanks,
Ed



Re: Problems writing binary uploaded data...

2002-10-23 Thread Issac Goldstand
Well, there are 2 issues here:
1) Getting $upload-link to work (yes, you can do it if you really want
to:-))
2) Fixing your original problem

So:

1) Use TEMP_DIR to set a different spool directory for the uploaded file:

From the same manpage: (under methods to pass $apr-new())

TEMP_DIR
Sets the directory where upload files are spooled. On a *nix-like that
supports link(2), the TEMP_DIR should be located on the same file system as
the final destination file:
 my $apr = Apache::Request-new($r, TEMP_DIR = /home/httpd/tmp);
 my $upload = $apr-upload('file');
 $upload-link(/home/user/myfile) || warn link failed: $!;

2) I'm not really sure - I only gave your problem a rather casual look-over,
but my first instinct is to add close (OUTFILE); to the end of your code -
perhaps it's not  flushing the output buffer to the file since you never
explicitly close the filehandle...

  Issac

- Original Message -
From: Leif Snorre Schøyen Boasson [EMAIL PROTECTED]
To: Issac Goldstand [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, October 22, 2002 8:51 PM
Subject: Re: Problems writing binary uploaded data...


 Well, the original reason I didn't use that was I didn't know what
 linking it was used for... (so much for RTFM... :) ).

 However, my /tmp (which Apache is using as it's tmp-directory) is on its
 own partition, so I cant really link it anywhere else but /tmp, which is
 not exactly where I'd like it to go... Is there any other way to get it
 saved directly like that, and not having to cp it somewhere else?

 (and I'd still like to know why my original code doesn't work... :) )

 Thanks alot for the advice, though!

 cheers
 Snorre

 On Tue, 22 Oct 2002, Issac Goldstand wrote:

  Um... Why don't you simply use $upload-link on the handle?
 
  From Apache::Request manpage
my $upload = $apr-upload('file');
$upload-link(/path/to/newfile) or
die sprintf link from '%s' failed: $!, $upload-tempname;
  /From Apache::Request manpage
 
Issac
 
  - Original Message -
  From: Leif Snorre Schøyen Boasson [EMAIL PROTECTED]
  To: mod_perl [EMAIL PROTECTED]
  Sent: Tuesday, October 22, 2002 6:08 PM
  Subject: Problems writing binary uploaded data...
 
 
   I'm trying to save an uploaded binary file (a jpg) through a
perlscript.
   The code doing this looks like:
  
  if (open OUTFILE, /var/www/tmp/test.jpg){
  
  binmode $ULFILE, :raw;
  binmode OUTFILE, :raw;
  
  while ($sizeread=read($ULFILE, $buffer, 1024)) {
  print OUTFILE $buffer;
  $size += $sizeread;
  }
  
  print brRead ,$size, bytes.;
  }
  
   Where ULFILE is the filehandle for the uploaded file, gotten from an
   Apache::Request object. Now, the sum of the sizes reported by the
   read-command is correct for the original jpg file I use to test, but
the
   written file is somewhat smaller (7192 bytes smaller), so I figure
   something gets lost in the writing. But I cant figure out how or
why...
  
   ...anybody see some reason why I shouldnt get the exact binary data
out?
  
 





Re: Problems writing binary uploaded data...

2002-10-23 Thread Issac Goldstand
Um... Why don't you simply use $upload-link on the handle?

From Apache::Request manpage
  my $upload = $apr-upload('file');
  $upload-link(/path/to/newfile) or
  die sprintf link from '%s' failed: $!, $upload-tempname;
/From Apache::Request manpage

  Issac

- Original Message -
From: Leif Snorre Schøyen Boasson [EMAIL PROTECTED]
To: mod_perl [EMAIL PROTECTED]
Sent: Tuesday, October 22, 2002 6:08 PM
Subject: Problems writing binary uploaded data...


 I'm trying to save an uploaded binary file (a jpg) through a perlscript.
 The code doing this looks like:

if (open OUTFILE, /var/www/tmp/test.jpg){

binmode $ULFILE, :raw;
binmode OUTFILE, :raw;

while ($sizeread=read($ULFILE, $buffer, 1024)) {
print OUTFILE $buffer;
$size += $sizeread;
}

print brRead ,$size, bytes.;
}

 Where ULFILE is the filehandle for the uploaded file, gotten from an
 Apache::Request object. Now, the sum of the sizes reported by the
 read-command is correct for the original jpg file I use to test, but the
 written file is somewhat smaller (7192 bytes smaller), so I figure
 something gets lost in the writing. But I cant figure out how or why...

 ...anybody see some reason why I shouldnt get the exact binary data out?





Re: Problems writing binary uploaded data...

2002-10-23 Thread paul . barker

Hmm, I've tried your code on my system and it does exactly what it's supposed
to. I get the same filesizes reported at the destination end and in the script
as the file is on my PC HDD.

Have you tried a different file ? Do you always loose the same amount ?

Cheers

Paul



***
Important.
Confidentiality: This communication is intended for the above-named person and
may be confidential and/or legally privileged. Any opinions expressed in this
communication are not necessarily those of the company. If it has come to you
in error you must take no action based on it, nor must you copy or show it to
anyone; please delete/destroy and inform the sender immediately.

Monitoring/Viruses
Orange may monitor all incoming and outgoing emails in line with current
legislation.  Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that in keeping with good
computing practice the recipient should ensure they are actually virus free.

Orange PCS Limited is a subsidiary of Orange SA and is registered in England No
2178917, with its address at St James Court, Great Park Road, Almondsbury Park,
Bradley Stoke, Bristol BS32 4QJ.
***