$r->user and UTF8 flag

2014-11-11 Thread Michael Schout
Hi.

I've noticed that when setting $r->user($value) if $value is a string
with the UTF8 flag on, calling $r->user returns the string without the
UTF8 flag on again.

In other words, this code:

use Devel::Peek;
$r->user($user);
warn Dump($user);
warn Dump($r->user);

If I pass $user = "úser"

the Dump of $user outputs

SV = PV(0x7f8a48d850b0) at 0x7f8a4afc1438
  REFCNT = 1
  FLAGS = (PADMY,POK,pPOK,UTF8)
  PV = 0x7f8a4bbf09d0 "\303\272ser"\0 [UTF8 "\x{fa}ser"]
  CUR = 5
  LEN = 16

Notice that the UTF8 flag is on.

But the dump of $r->user is:

SV = PV(0x7f8a42ba67c0) at 0x7f8a4afc17b0
  REFCNT = 1
  FLAGS = (PADTMP,POK,pPOK)
  PV = 0x7f8a4bbfbb60 "\303\272ser"\0
  CUR = 5
  LEN = 16

Notice that the UTF8 flag is off on the value returned by r->user.

I'm guessing this is normal behavior due to the fact that $r->user calls
the Apache C API directly?

I'm wondering how others have dealt with situations like this. Is there
any way to get a scalar out of $r->user with the UTF8 flag turned on iff
it was set with a value that had the UTF8 flag turned on?  I know the
following works:

$user = Encode::decode('UTF-8', $r->user)

But I really would have expected $r->user to return a value with the
UTF8 flag already on since the value that I used to set it did in fact
have the flag turned on.

FWIW, this is mod_perl 2.0.8, Apache 2.2.29

Regards,
Michael Schout


Apache2::Filter internal flush error

2014-11-11 Thread Paul Silevitch
Hello mod_perl-ers,

I'm seeing a fair amount of these in my apache error log:

Apache2::Filter internal flush: (-3) Unknown error 4294967293 at -e line 0

I'm running apache 2.2.29, mod_perl 2.0.8 on linux.

Looking at the source code, it looks like I'm getting into this else-block
in 'src/modules/perl/modperl_error.h':

 if (rc != APR_SUCCESS) {
if (APR_STATUS_IS_ECONNRESET(rc) ||
APR_STATUS_IS_ECONNABORTED(rc)) {
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
 "%s got: %s", func,
 modperl_error_strerror(aTHX_ rc));
}
else {
modperl_croak(aTHX_ rc, func);
}
}


What cases fall into the else-block?  What is the best way to debug?

Thanks,

Paul