Subject: | parse response, continued |
Sorry, I know I am just breking rules, by using a 2nd bug. I was expecting an "add note" on my previous one, but couldnt find it)
Here is the subclass for respnses
package Http::Parser::Response;
use base qw/ Http::Parser /;
use HTTP::Response;
sub _get_http_obj {
my $self = shift;
return HTTP::Response->new(@_);
}
sub _parse_first_header_line {
my ($self, $request) = @_;
my ($http, $state, $msg) = split / /,$request;
die "bad response line '$request'"
unless $http and $http =~ /^HTTP\/(\d+)\.(\d+)$/i;
my ($major,$minor) = ($1,$2);
my $req = $self->_get_http_obj($state, $msg);
$req->header(X_HTTP_Version => "$major.$minor"); # pseudo-header
return $req;
}
1;