This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-API] [PATCH] be more accepting of non-UTC ISO8601 dates in XMLRPC

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] be more accepting of non-UTC ISO8601 dates in XMLRPC
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 29 Mar 2010 16:48:12 +0100
Delivery-date: Mon, 29 Mar 2010 10:46:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1269877428 -3600
# Node ID be8e20f5cf060acf17a5c9014bcc68dd0d0c2626
# Parent  03710626e21a3f564d06e1b33a728989dda821cf
CA-38687: be more accepting of ISO8601 dates without a timezone.

Note that xapi expects all dates to be in UTC; xapi knows nothing about 

The XMLRPC spec is vague but encourages people to *omit* the timezone 
information from requests. We now accept such vague inputs but we still expect 
them to be in UTC.

The following python snippet produces no results without the fix and the full 
message list (as expected) with the fix:

#!/usr/bin/env python

import xmlrpclib

x = xmlrpclib.Server("http://localhost";)
session = x.session.login_with_password("root", "password")["Value"]
print repr(x.message.get_since(session, xmlrpclib.DateTime(0)))

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 03710626e21a -r be8e20f5cf06 stdext/date.ml
--- a/stdext/date.ml    Mon Mar 29 10:47:47 2010 +0100
+++ b/stdext/date.ml    Mon Mar 29 16:43:48 2010 +0100
@@ -41,7 +41,7 @@
 (* Convert tm in localtime to calendar time, x *)
 let to_float_localtime x = 
-  Scanf.sscanf x "%04d%02d%02dT%02d:%02d:%02dZ"
+  Scanf.sscanf x "%04d%02d%02dT%02d:%02d:%02d"
     (fun y mon d h min s ->
        fst (Unix.mktime { Unix.tm_year = y - 1900;
                          tm_mon = mon - 1;
1 file changed, 1 insertion(+), 1 deletion(-)
stdext/date.ml |    2 +-

Attachment: xen-api-libs.hg.patch
Description: Text Data

xen-api mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] be more accepting of non-UTC ISO8601 dates in XMLRPC, David Scott <=