Hello, I'm trying to transform a not-really-HTTP request (first line containing method differs) to HTTP using PerlTransHandler, like this:
sub Trans::handler {
my ($r) = @_;
my $method = $r->method;
if ($r->method eq 'FOO') {
$r->server->method_register($method);
$r->method('POST');
$r->filename(1);
$r->uri('/');
return Apache2::Const::OK;
}
return Apache2::Const::DECLINED;
}
So, if client sends "FOO blah whatever", I would like it to be changed
to "POST / HTTP/1.1".
But... this doesn't quite work. $r->protocol for these requests
contains "HTTP/0.9". The difference is: HTTP headers are neither
printed nor generated ($r->headers_out is empty).
Can I force HTTP/1.1 in PerlTransHandler somehow?
If not, can I force headers to be generated (without doing that manually)?
I've tried Apache2::SubRequest, but succeeded only with segfaults (after
$subreq->run).
My response handler:
sub Resp::handler {
my ($r) = @_;
warn $r->protocol;
$r->content_type("text/plain");
$r->status(200);
$r->print("foo\nbar\n");
return Apache2::Const::OK;
}
Configuration:
SetHandler modperl
PerlTransHandler Trans
PerlResponseHandler Resp
I know I could get it done using filters, but writing them is a pain...
--
Radosław Zieliński <[EMAIL PROTECTED]>
pgpTuPtNKuF4u.pgp
Description: PGP signature
