Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Odd problem with Links::Tools :/

Quote Reply
Odd problem with Links::Tools :/
Hi guys/gals. Don't suppose anyone knows why a URL such as;

http://www.amazon.co.uk/exec/obidos/redirect-home?tag=aceinst&site=amazon

..which redirects to;

http://www.amazon.co.uk/exec/obidos/tg/stores/browse/-/welcome/468294/202-1957373-2339056

The problem comes with the below code;

Code:
# Create a request
$code_returned = Links::Tools::link_status($url) || "404";

The problem is, that URL's such as the above, are giving -4 error codes back.

Anyone got any ideas?

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Aug 4, 2004, 3:19 AM
Quote Reply
Re: [Andy] Odd problem with Links::Tools :/ In reply to
It's happening because amazon's server isn't returning the right thing (and there's a bug in the code).

You need to fix Links::Tools::link_status:
Code:
if (!$response) {
Code:
if (!$response->status) {
and
Code:
$response or return -4;
Code:
$response->status or return -4;

and also, in GT::WWW::http:
Code:
--- GT/WWW/http.pm 4 Aug 2004 19:23:07 -0000 1.23
+++ GT/WWW/http.pm 4 Aug 2004 19:29:58 -0000
@@ -551,11 +551,11 @@
# When using keep-alive connections, there will (sometimes?) be a blank line here
$self->{sock}->readline($status);
}
- $status =~ m|^HTTP/(1\.[10]) ([1-5]\d\d) ([^\r\n]*)|
+ $status =~ m|^HTTP/(1\.[10]) ([1-5]\d\d)(?: ([^\r\n]*))?|
or return $self->error("Server returned invalid status-line: $status");
$response->server_version($1);
my $int_status = $2;
- $response->status($int_status, $3);
+ $response->status($int_status, $3 || '');

my ($line, $last, $last_value);
while ($self->{sock}->readline($line) and $line =~ /[^\015\012]/) {

Adrian
Quote Reply
Re: [brewt] Odd problem with Links::Tools :/ In reply to
Thanks Smile I'll give that a go.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [brewt] Odd problem with Links::Tools :/ In reply to
In Reply To:
It's happening because amazon's server isn't returning the right thing (and there's a bug in the code).

You need to fix Links::Tools::link_status:
Code:
if (!$response) {
Code:
if (!$response->status) {
and
Code:
$response or return -4;
Code:
$response->status or return -4;

and also, in GT::WWW::http:
Code:
--- GT/WWW/http.pm 4 Aug 2004 19:23:07 -0000 1.23
+++ GT/WWW/http.pm 4 Aug 2004 19:29:58 -0000
@@ -551,11 +551,11 @@
# When using keep-alive connections, there will (sometimes?) be a blank line here
$self->{sock}->readline($status);
}
- $status =~ m|^HTTP/(1\.[10]) ([1-5]\d\d) ([^\r\n]*)|
+ $status =~ m|^HTTP/(1\.[10]) ([1-5]\d\d)(?: ([^\r\n]*))?|
or return $self->error("Server returned invalid status-line: $status");
$response->server_version($1);
my $int_status = $2;
- $response->status($int_status, $3);
+ $response->status($int_status, $3 || '');

my ($line, $last, $last_value);
while ($self->{sock}->readline($line) and $line =~ /[^\015\012]/) {



I didn't understand what code had to be fixed in the last part starting from :
"and also, in GT::WWW::http: "

What lines should be changed from which file(s)?
Quote Reply
Re: [dwh] Odd problem with Links::Tools :/ In reply to
Hi. The files in question are;

admin/Links/Tools.pm, routine &link_status
admin/GT/WWW, routine &http

.. and that should be it :)

The --- means that a line has been taken out, and a +++ means that its been put in (its a reverse backup method of showing the code, so you can back-work/forward-work different versions :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Odd problem with Links::Tools :/ In reply to
In Reply To:
Hi. The files in question are;

admin/Links/Tools.pm, routine &link_status
admin/GT/WWW, routine &http
Thanks. What confuses me is that I only have a directory called WWW and both a file and directory called http.

Last edited by:

dwh: Aug 27, 2004, 1:39 AM
Quote Reply
Re: [dwh] Odd problem with Links::Tools :/ In reply to
Was there meant to be a reply? Unimpressed

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [dwh] Odd problem with Links::Tools :/ In reply to
Found those lines in http.pm and fixed them but it didn't fix my problem. I'm getting this error on some URLs that have redirects:

A fatal error has occured:Invalid query string '' at /home/wc/www/links/admin/Links/Tools.pm line 328 - Missing URL - Request Failed (unresolvable) The URL is definitely not missing

Last edited by:

dwh: Aug 27, 2004, 1:42 AM
Quote Reply
Re: [dwh] Odd problem with Links::Tools :/ In reply to
How/where are you having these problems? Plugin? Global? Script? Link verification? We're not mind readers =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Odd problem with Links::Tools :/ In reply to
Sorry :)

Code:
http://www.domain.com/links/admin/nph-verify.cgi?do=check_links&method=7&ID=2924

Last edited by:

dwh: Aug 27, 2004, 1:41 AM
Quote Reply
Re: [dwh] Odd problem with Links::Tools :/ In reply to
Ah, in that case, can you try the following;

http://www.gossamer-threads.com/...i?post=268697#268697

There was a bug in the first 2.2.0 release, which should be fixed up now (just upgrade the apropriate files, and it should work).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Odd problem with Links::Tools :/ In reply to
Ah. Thank you so much. This one really worried me. Had no clue what was going on. :)