[Rt-devel] Authentication issue with RT::Client

Drew Taylor dtaylor at cidc.com
Tue Apr 18 18:33:42 EDT 2006


Hi everyone,

We're using RT::Client to do customization of outgoing email based on some
custom fields (in a heavily customized RT 3.2.1), and seeing some odd
behaviors regarding authentication. In a nutshell, we create an instance of
the RT::Client object, then for a ticket we get the number of CustomFields,
then make calls to get each individual custom field value. Like so:

my $rt = $self->init_rt(); # creates RT::Client instance

my $custom_field_count =
$rt->get("RT-Tickets/$ticket_number/CustomFieldValues.\
Count");

if ($custom_field_count) {
  foreach my $count (0..($custom_field_count - 1)) {
    eval {
      my $content = $rt->get("RT-Tickets/$ticket_number/CustomFieldValues\
/*$count.Content");
      my $id = $rt->get("RT-Tickets/$ticket_number/CustomFieldValues/*$co\
unt.CustomField");
      ....
    };
  }
}

It works, but for each request to get the value it ends up making 2
requests. The first gets a 401 response (expected since we need to
authenticate), and the second succeeds with a 200 response. However, I get
this series of requests for EVERY call to get a custom field value. The logs
look like this:

xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues.Count HTTP/1.1" 401 5
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues.Count HTTP/1.1" 200 15
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues/*0.Content HTTP/1.1" 401 5
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues/*0.Content HTTP/1.1" 200 24
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues/*0.CustomField HTTP/1.1" 401 5
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues/*0.CustomField HTTP/1.1" 200
14
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues/*1.Content HTTP/1.1" 401 5
xx.xx.xx.xx - - [18/Apr/2006:18:54:48 +0000] "GET
/Atom/0.3/RT-Tickets/156521/CustomFieldValues/*1.Content HTTP/1.1" 200 20

Why doesn't it go ahead and send the authentication information once it has
been determined that the server needs it? It creates double the number of
calls needed if the authentication information was included in the
subsequent calls. Server load is no longer an issue, but it irks me to have
this behavior.

Thanks,
Drew
Sent using the Microsoft Entourage 2004 for Mac Test Drive.



More information about the Rt-devel mailing list