Skip Menu |

This queue is for tickets about the WWW-CheckSite CPAN distribution.

Report information
The Basics
Id: 15771
Status: resolved
Priority: 0/
Queue: WWW-CheckSite

People
Owner: abeltje [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.015
Fixed in: (no value)



Subject: WWW::Checksite::Validator::check_links should accept XHTML pages
WWW::CheckSite::Validator only accepts text/html pages in the check_links() method. It would be nice if it also accepts typical content-types for XHTML pages. This might be * application/xhtml+xml * application/vnd.wap.xhtml+xml * text/xhtml Also, I'm not sure if a charset in the content-type header would be accepted by the "eq" (e.g. something like "text/html; charset=utf-8"). Regards, Slaven
[SREZIC - Mon Nov 14 09:46:45 2005]: Show quoted text
> WWW::CheckSite::Validator only accepts text/html pages in the > check_links() method. It would be nice if it also accepts typical > content-types for XHTML pages. This might be > > * application/xhtml+xml > * application/vnd.wap.xhtml+xml > * text/xhtml
I have applied the following patch: Index: lib/WWW/CheckSite/Validator.pm ========================================================= ========== --- lib/WWW/CheckSite/Validator.pm (revision 436) +++ lib/WWW/CheckSite/Validator.pm (revision 437) @@ -4,7 +4,7 @@ # $Id$ use vars qw( $VERSION $VALIDATOR_URL $VALIDATOR_FRM $VALIDATOR_STYLE ); -$VERSION = '0.008'; +$VERSION = '0.009'; =head1 NAME @@ -165,7 +165,7 @@ $self->{v} and printf "done(%sok).\n", $ua->success ? '' : 'not '; - $ua->success && $ua->ct ne 'text/html' and + $ua->success && ! $self->ct_can_validate( $ua ) and $in_cache->[0] = WCS_NOCONTENT; } } @@ -525,6 +525,21 @@ return $valid; } +=head2 $wcs->ct_can_validate( $ua ) + +Check if the content-type is "validatable". + +=cut + +sub ct_can_validate { + my( $self, $ua ) = @_; + + return $ua->ct =~ m[^text/html] || + $ua->ct =~ m[^text/xhtml] || + $ua->ct =~ m[^application/xhtml+xml] || + $ua->ct =~ m[^application/vnd.wap.xhtml+xml]; +} + =head2 $wcs->set_action Why? -- Generated by 'svnchanges' (0.013) -- HTH + Good luck, -- Abe.
From: srezic [...] cpan.org
[ABELTJE - Sun Dec 4 06:21:06 2005]: Show quoted text
> [SREZIC - Mon Nov 14 09:46:45 2005]: >
> > WWW::CheckSite::Validator only accepts text/html pages in the > > check_links() method. It would be nice if it also accepts typical > > content-types for XHTML pages. This might be > > > > * application/xhtml+xml > > * application/vnd.wap.xhtml+xml > > * text/xhtml
> > I have applied the following patch: > Index: lib/WWW/CheckSite/Validator.pm > ========================================================= > ========== > --- lib/WWW/CheckSite/Validator.pm (revision 436) > +++ lib/WWW/CheckSite/Validator.pm (revision 437) > @@ -4,7 +4,7 @@ > > # $Id$ > use vars qw( $VERSION $VALIDATOR_URL $VALIDATOR_FRM $VALIDATOR_STYLE > ); > -$VERSION = '0.008'; > +$VERSION = '0.009'; > > =head1 NAME > > @@ -165,7 +165,7 @@ > $self->{v} and > printf "done(%sok).\n", $ua->success ? '' : 'not > '; > > - $ua->success && $ua->ct ne 'text/html' and > + $ua->success && ! $self->ct_can_validate( $ua ) and > $in_cache->[0] = WCS_NOCONTENT; > } > } > @@ -525,6 +525,21 @@ > return $valid; > } > > +=head2 $wcs->ct_can_validate( $ua ) > + > +Check if the content-type is "validatable". > + > +=cut > + > +sub ct_can_validate { > + my( $self, $ua ) = @_; > + > + return $ua->ct =~ m[^text/html] || > + $ua->ct =~ m[^text/xhtml] || > + $ua->ct =~ m[^application/xhtml+xml] || > + $ua->ct =~ m[^application/vnd.wap.xhtml+xml]; > +} > + > =head2 $wcs->set_action > > Why? > > > -- Generated by 'svnchanges' (0.013) -- >
I have to reopen the bug --- the regexpes should of course have "+" and "." escaped. Or rewrite it to use index() instead. Regards, Slaven
[SREZIC - Wed Dec 7 09:07:13 2005]: Show quoted text
> [ABELTJE - Sun Dec 4 06:21:06 2005]:
... Show quoted text
> > +sub ct_can_validate { > > + my( $self, $ua ) = @_; > > + > > + return $ua->ct =~ m[^text/html] || > > + $ua->ct =~ m[^text/xhtml] || > > + $ua->ct =~ m[^application/xhtml+xml] || > > + $ua->ct =~ m[^application/vnd.wap.xhtml+xml];
Show quoted text
> > I have to reopen the bug --- the regexpes should of course have "+" > and "." escaped. Or rewrite it to use index() instead.
I hope this is ok then: Index: lib/WWW/CheckSite/Validator.pm ========================================================= ========== --- lib/WWW/CheckSite/Validator.pm (revision 439) +++ lib/WWW/CheckSite/Validator.pm (working copy) @@ -4,7 +4,7 @@ # $Id$ use vars qw( $VERSION $VALIDATOR_URL $VALIDATOR_FRM $VALIDATOR_STYLE ); -$VERSION = '0.010'; +$VERSION = '0.011'; =head1 NAME @@ -534,10 +534,10 @@ sub ct_can_validate { my( $self, $ua ) = @_; - return $ua->ct =~ m[^text/html] || - $ua->ct =~ m[^text/xhtml] || - $ua->ct =~ m[^application/xhtml+xml] || - $ua->ct =~ m[^application/vnd.wap.xhtml+xml]; + return $ua->ct =~ m[^\Qtext/html\E] || + $ua->ct =~ m[^\Qtext/xhtml\E] || + $ua->ct =~ m[^\Qapplication/xhtml+xml\E] || + $ua->ct =~ m[^\Qapplication/vnd.wap.xhtml+xml\E]; } =head2 $wcs->set_action HTH, -- Abe.