[rt-devel] [RT-3.0.4][PATCH] Backward compatibility and RFC compliance.

Ruslan U. Zakirov cubic at acronis.ru
Mon Aug 4 07:21:31 EDT 2003


        Hello. Jesse.
Here is patch that turn off case sensitivity in RT/URI/fsck_com_rt.pm
I've done it because of bug that come to light when I tried to use old 
config and our company name started with char in Upper case, but 
URIprefix not.
All this cause a use of uninitialised value at RT/URI/fsck_com_rt.pm.
And this behavior don't compliance RFC
http://www.ietf.org/rfc/rfc2616.txt

3.2.3 URI Comparison

   When comparing two URIs to decide if they match or not, a client
   SHOULD use a case-sensitive octet-by-octet comparison of the entire
   URIs, with these exceptions:

      - A port that is empty or not given is equivalent to the default
        port for that URI-reference;

        - Comparisons of host names MUST be case-insensitive;

        - Comparisons of scheme names MUST be case-insensitive;

        - An empty abs_path is equivalent to an abs_path of "/".

   Characters other than those in the "reserved" and "unsafe" sets (see
   RFC 2396 [42]) are equivalent to their ""%" HEX HEX" encoding.

I think that there is also bug:
1) Define only if is Local
=head2 Object
                                                                                                                              
Returns the object for this URI, if it's local. Otherwise returns undef.
                                                                                                                              
=cut
2) And sub ParseURI is "fully" conform with (1)
3) Look at this code:
sub AsString {
    my $self = shift;
    if ($self->IsLocal) {
        return $self->loc("ticket #[_1]", $self->Object->Id);
                                                                                                                              
    }
    else {
        return $self->Object->URI;		# URI IsNotLocal => Object is undef !!!
    }
}

And we got error at browser.


[PATCH] About case sensitivity
--- lib/RT/URI/fsck_com_rt.pm.org       Mon Aug  4 15:18:18 2003
+++ lib/RT/URI/fsck_com_rt.pm   Mon Aug  4 14:07:45 2003
@@ -133,7 +133,7 @@
     if ( $self->IsLocal) {
     
         my $local_uri_prefix = $self->LocalURIPrefix;
-       if ($self->{'uri'} =~ /^$local_uri_prefix(\d+)$/) {
+       if ($self->{'uri'} =~ /^$local_uri_prefix(\d+)$/i) {
                my $id = $1;
      
      
@@ -170,7 +170,7 @@
 sub IsLocal {
        my $self = shift;
         my $local_uri_prefix = $self->LocalURIPrefix;
-       if ($self->{'uri'} =~ /^$local_uri_prefix/) {
+       if ($self->{'uri'} =~ /^$local_uri_prefix/i) {
                return 1;
     }
        else {






More information about the Rt-devel mailing list