I'm buiding an HTTP gateway in mod_perl and trying to send back to the
client exactly what I get from the remote server. The remote server
doesn't set a Content-Type on the document being returned, so I don't want
to set one either.
However, Mod_perl (or Apache), doesn't like it when I don't send a
Content-type and seems to send a default of text/plain regardless. I
don't want this. I don't want any Content-type at all.
What I have now is sending mod_perl a Content-Type of ''. This sends a
blank Content-Type to the browser. How can I avoid doing this?
Suggestions?
Here is an abbreviated program:
sub handler {
my $r = Apache->request;
my $ip = '1.2.3.4'; my $port = 80;
my $ua = new LWP::UserAgent;
my $request = new HTTP::Request $r->method, "http://$ip:$port" . $r->uri;
my $response = $ua->request($request);
if (defined $response->header('Content-type')) {
$r->content_type($res->header('Content-type'));
} else {
$r->content_type(''); # don't want to do this
}
$r->status($response->code);
$r->status_line(join " ", $response->code, $response->message);
$response->scan(sub {
$r->header_out(@_);
});
$r->send_http_header;
$r->print($response->content);
}
This is actually what the device returns:
% telnet realdevice 80
Trying 1.2.3.4...
Connected to realdevice.
Escape character is '^]'.
GET /
HTTP/1.0 200 OK
<HTML>
[chop]
</HTML>
--
Matthew Darwin
[EMAIL PROTECTED]