Subject: | lwp-request doesn't honour options -b while dumping links |
Hi,
this is a bug that was reported to Debian some time ago, and we solved
it with a small patch (included). This is the original bug text:
suppose you have retrieved a copy of http:/a.b.c/d/e.html and saved it
in a local repository /my/repo, and then you want to extract links
(based on the original url) from the saved file.
the first thing that comes to my mind,
$ lwp-request -o links -b http:/a.b.c/d/e.html file:/my/repo/e.html
does not work, because lwp-request picks the base url from the url it is
parsing (namely file:/my/repo/e.html)
Please consider including it in the next release.
Thanks.
Subject: | lwp-request_use_base_when_dumping_links.patch |
Index: libwww-perl/bin/lwp-request
===================================================================
--- libwww-perl.orig/bin/lwp-request
+++ libwww-perl/bin/lwp-request
@@ -473,6 +473,7 @@ while ($url = shift) {
};
$options{'o'} eq 'links' && do {
my $base = $response->base;
+ $base = $options{'b'} if $options{'b'};
for ( @{ $html->extract_links } ) {
my($link, $elem) = @$_;
my $tag = uc $elem->tag;