HTTP Error 501 - can only handle messages/appointments/tasks/documents
Hi!
I also got the 501 HTTP error, but was able to find out the cause of the problem. If there is an ampersand (@) in the password, authentication fails because the GET-Request looks like this:
https://user:p@ssword@host.domain/zimbra/home/user/inbox.atom?query=is:unread
Of course this won't work...
The solution is to authenticate using the HTTP::Headers function:
--- zimbranotify.orig 2008-02-14 13:42:07.000000000 +0100
+++ zimbranotify 2009-06-16 18:51:49.000000000 +0200
@@ -707,10 +707,12 @@
my @username = split(/\@/,$user);
my $httpmode = $save_ssl ? "https" : "http";
- my $req_string = "$httpmode://$username[0]:$password\@$server$zimbra_path$user$zimbra_mail_u ri";
+ my $req_string = "$httpmode://$server$zimbra_path$user$zimbra_mail_uri";
$http_status->enqueue($trans{notify_check});
- my $req = HTTP::Request->new(GET => $req_string);
+ my $hdr = new HTTP::Headers;
+ $hdr->authorization_basic($username[0], $password);
+ my $req = HTTP::Request->new("GET", $req_string, $hdr);
my $error;
my $response = $ua->request($req);
Hope this helps... ;-)
Regards,
Daniel