A couple of Perl proxy bugs…

26 views
Skip to first unread message

Gabriel Hauber

unread,
Jun 22, 2016, 1:31:25 AM6/22/16
to JMAP
A couple of things I've come across and worked around as I test my client…

- the event source is sending invalid delimiters - instead of \n\n it is sending \r\n\r\n

- message list paging with an anchor message doesn't work - an error is returned instead:

{
  "message" : "Not an ARRAY reference at \/home\/jmap\/jmap-perl\/JMAP\/API.pm line 637.\n",
  "type" : "serverError"
}

Perl is like a foreign language to me, otherwise I'd fix these myself!

Regards,

Gabriel

Bron Gondwana

unread,
Jun 22, 2016, 1:42:03 AM6/22/16
to jmap-d...@googlegroups.com
 
 
 
On Wed, Jun 22, 2016, at 15:31, Gabriel Hauber wrote:
A couple of things I've come across and worked around as I test my client…
 
- the event source is sending invalid delimiters - instead of \n\n it is sending \r\n\r\n
 
According to the spec, we are correct:
 
 
end-of-line   = ( cr lf / cr / lf )
 
What library are you using which has a problem with that?  Because they're wrong.
 
- message list paging with an anchor message doesn't work - an error is returned instead:
 
{
  "message" : "Not an ARRAY reference at \/home\/jmap\/jmap-perl\/JMAP\/API.pm line 637.\n",
  "type" : "serverError"
}
 
Perl is like a foreign language to me, otherwise I'd fix these myself!
 
Which version are you using?
 
commit 2739c635adb204104aaea140c4bdf2223b0275b8
Author: Bron Gondwana <br...@fastmail.fm>
Date:   Thu May 26 23:55:27 2016 -0400
 
    API: handle anchor correctly
 
diff --git a/JMAP/API.pm b/JMAP/API.pm
index 52f5725..89c1749 100644
--- a/JMAP/API.pm
+++ b/JMAP/API.pm
@@ -638,7 +638,7 @@ sub getMessageList {
   if ($args->{anchor}) {
     # need to calculate the position
     for (0..$#$data) {
-      next unless $data->[$_][0] eq $args->{anchor};
+      next unless $data->[$_]{msgid} eq $args->{anchor};
       $start = $_ + $args->{anchorOffset};
       $start = 0 if $start < 0;
       goto gotit;
 
...
 
Looks like I fixed this nearly a month ago.
 
Cheers,
 
Bron.
 
--
  Bron Gondwana
 
 

Gabriel Hauber

unread,
Jun 24, 2016, 9:01:43 AM6/24/16
to jmap-d...@googlegroups.com
Hi Bron,

According to the spec, we are correct:
 
 
end-of-line   = ( cr lf / cr / lf )
 
What library are you using which has a problem with that?  Because they're wrong.

And… so you are! I was sure when I was first researching this I saw documentation that suggested otherwise. But there it is, so apologies for getting this wrong! I am using this library: https://github.com/inaka/EventSource

 
- message list paging with an anchor message doesn't work - an error is returned instead:
 
{
  "message" : "Not an ARRAY reference at \/home\/jmap\/jmap-perl\/JMAP\/API.pm line 637.\n",
  "type" : "serverError"
}
 
Perl is like a foreign language to me, otherwise I'd fix these myself!
 
Which version are you using?
 
commit 2739c635adb204104aaea140c4bdf2223b0275b8
Author: Bron Gondwana <br...@fastmail.fm>
Date:   Thu May 26 23:55:27 2016 -0400
 
    API: handle anchor correctly
 
diff --git a/JMAP/API.pm b/JMAP/API.pm
index 52f5725..89c1749 100644
--- a/JMAP/API.pm
+++ b/JMAP/API.pm
@@ -638,7 +638,7 @@ sub getMessageList {
   if ($args->{anchor}) {
     # need to calculate the position
     for (0..$#$data) {
-      next unless $data->[$_][0] eq $args->{anchor};
+      next unless $data->[$_]{msgid} eq $args->{anchor};
       $start = $_ + $args->{anchorOffset};
       $start = 0 if $start < 0;
       goto gotit;
 
...
 
Looks like I fixed this nearly a month ago.
 

Not sure… another one of the folk here set it up, and I’m not sure it’s been updated to keep up with the changes (I thought it had been…) I will check and re-test my code next week.

Thanks for the replies!

Gabriel

Reply all
Reply to author
Forward
0 new messages