This file is indexed.

/usr/share/perl5/LWP/Protocol/GHTTP.pm is in libwww-perl 6.08-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package LWP::Protocol::GHTTP;

# You can tell LWP to use this module for 'http' requests by running
# code like this before you make requests:
#
#    require LWP::Protocol::GHTTP;
#    LWP::Protocol::implementor('http', 'LWP::Protocol::GHTTP');
#

use strict;
use vars qw(@ISA);

require LWP::Protocol;
@ISA=qw(LWP::Protocol);

require HTTP::Response;
require HTTP::Status;

use HTTP::GHTTP qw(METHOD_GET METHOD_HEAD METHOD_POST);

my %METHOD =
(
 GET  => METHOD_GET,
 HEAD => METHOD_HEAD,
 POST => METHOD_POST,
);

sub request
{
    my($self, $request, $proxy, $arg, $size, $timeout) = @_;

    my $method = $request->method;
    unless (exists $METHOD{$method}) {
	return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
				   "Bad method '$method'");
    }

    my $r = HTTP::GHTTP->new($request->uri);

    # XXX what headers for repeated headers here?
    $request->headers->scan(sub { $r->set_header(@_)});

    $r->set_type($METHOD{$method});

    # XXX should also deal with subroutine content.
    my $cref = $request->content_ref;
    $r->set_body($$cref) if length($$cref);

    # XXX is this right
    $r->set_proxy($proxy->as_string) if $proxy;

    $r->process_request;

    my $response = HTTP::Response->new($r->get_status);

    # XXX How can get the headers out of $r??  This way is too stupid.
    my @headers;
    eval {
	# Wrapped in eval because this method is not always available
	@headers = $r->get_headers;
    };
    @headers = qw(Date Connection Server Content-type
                  Accept-Ranges Server
                  Content-Length Last-Modified ETag) if $@;
    for (@headers) {
	my $v = $r->get_header($_);
	$response->header($_ => $v) if defined $v;
    }

    return $self->collect_once($arg, $response, $r->get_body);
}

1;