Re: IMAP4 server : response to FETCH

Roman Parparov <romm@tochna.technion.ac.il> Wed, 27 August 1997 12:17 UTC

Received: from cnri by ietf.org id aa04784; 27 Aug 97 8:17 EDT
Received: from lists.u.washington.edu (root@lists.u.washington.edu [140.142.56.13]) by cnri.reston.va.us (8.8.5/8.7.3) with ESMTPid IAA09514 for <ietf-archive@CNRI.Reston.VA.US>; Wed, 27 Aug 1997 08:21:06 -0400 (EDT)
Received: from host (server@lists.u.washington.edu [140.142.56.13]) by lists.u.washington.edu (8.8.4+UW97.07/8.8.4+UW97.05) with SMTP id FAA17834; Wed, 27 Aug 1997 05:10:21 -0700
Received: from mx3.u.washington.edu (mx3.u.washington.edu [140.142.13.230]) by lists.u.washington.edu (8.8.4+UW97.07/8.8.4+UW97.05) with ESMTP id FAA25146 for <imap@lists.u.washington.edu>; Wed, 27 Aug 1997 05:10:00 -0700
Received: from tochna.technion.ac.il (romm@tochna.technion.ac.il [132.68.48.10]) by mx3.u.washington.edu (8.8.4+UW97.07/8.8.4+UW97.04) with SMTP id FAA10798 for <imap@u.washington.edu>; Wed, 27 Aug 1997 05:09:53 -0700
Received: by tochna.technion.ac.il; (5.65v3.2/1.1.8.2/26Feb95-1214AM) id AA09966; Wed, 27 Aug 1997 15:09:07 +0300
Message-Id: <9708271209.AA09966@tochna.technion.ac.il>
Date: Wed, 27 Aug 1997 15:09:06 +0200
Sender: IMAP-owner@u.washington.edu
Precedence: bulk
From: Roman Parparov <romm@tochna.technion.ac.il>
To: imap@u.washington.edu
Cc: MRC@cac.washington.edu, imap@u.washington.edu
Subject: Re: IMAP4 server : response to FETCH
In-Reply-To: <199708271154.RAA16802@ruksun.com> from "Anita" at Aug 27, 97 04:55:17 pm
Mime-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
X-Listprocessor-Version: 8.1 beta -- ListProcessor(tm) by CREN

> 
> -- [ From: Anita * EMC.Ver #b.2.5.06 ] --
> 
> Hello,
> 
> Does RFC 2060 recommend any standard for IAMP4 servers, when the server
> responds to a FETCH command? 
> Here is response to Fetch command on two test servers. And the two servers
> return values in varying order. Cyrus returns UID immediately after flags,
> Altavista mail server returns UID as the last value in the response string.
>  
> These differences in server implementation make the parsing task quite
> tedious.
> Any suggestions? Anyone?
> 
> sample responses are here :-
> 
> 
> #1 cyrus.andrew.cmu.edu (Cyrus IMAP4 v1.5.3 alpha server)
> -----------------------
> a FETCH 1 (FLAGS BODYSTRUCTURE UID)
> 
> * 1 FETCH (FLAGS (\Seen) UID 1 BODYSTRUCTURE ("TEXT" "PLAIN" ("CHARSET" "ISO
> -885 9-2") NIL NIL "8BIT" 214 6 NIL NIL NIL))
>  a OK Completed
> 
> #2 Altavista Mail server(evaluation copy) 
> -----------------------------------------------------------
> a FETCH 1 (FLAGS BODYSTRUCTURE UID)
> 
> * 1 FETCH (FLAGS (\Seen) BODYSTRUCTURE (("TEXT" "PLAIN" ("charset" "US-
> ASCII") N IL NIL "7BIT" 240 9 NIL) "MIXED" NIL) UID 148)
>  a OK
> 
I think, the parsing isn't going to be much harder, since FIELD VALUE
structure is being preserved. So, if you scan the returned pattern
where the internal parenthesis contents whitespaces are ignored, 
and put the words between the white spaces into an array - its odd
member will yield field names (FLAGS, BODYSTRUCTURE, UID etc.) and
the even ones - their corresponding values. In Perl you may just
read them into a hash, and then the order does not matter!

		Roman.
-- 
# Roman M. Parparov, EE department, Technion.	| The most dangerous thing
# Email & phone:romm@tochna.technion.ac.il,	| to do while riding a     
#       +972-(0)4-8282681,+972-(0)8-9419230	| tiger is to stop!    
# URL: http://tochna.technion.ac.il/~romm/	|                Folklore.