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] fix occasional failure uploading patches

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] fix occasional failure uploading patches
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Tue, 16 Mar 2010 22:31:20 +0000
Delivery-date: Tue, 16 Mar 2010 15:29:57 -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 1268778573 0
# Node ID 5b343db0055dda379733d518826b36465114e34b
# Parent  eca655c1a7c86ac7ce924e2f72ff542669c5be98
CA-31448: unconditionally read all the HTTP headers resulting from an HTTP PUT, 
not just the first line.

xapi HTTP handlers (eg the patch upload one) expext to be able to write a 
complete set of HTTP response headers, without someone closing the socket and 
triggering an EPIPE.

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

diff -r eca655c1a7c8 -r 5b343db0055d ocaml/xe-cli/newcli.ml
--- a/ocaml/xe-cli/newcli.ml    Tue Mar 16 20:56:42 2010 +0000
+++ b/ocaml/xe-cli/newcli.ml    Tue Mar 16 22:29:33 2010 +0000
@@ -289,6 +289,7 @@
                Printf.fprintf oc "PUT %s HTTP/1.0\r\ncontent-length: 
%Ld\r\n\r\n" path stat.Unix.LargeFile.st_size;
                flush oc;
                let resultline = input_line ic in
+               let headers = read_rest_of_headers ic in
                (* Get the result header immediately *)
                match http_response_code resultline with
                  | 200 -> 
@@ -299,7 +300,6 @@
                        Unix.shutdown fd' Unix.SHUTDOWN_SEND;
                        marshal ofd (Response OK)
                  | 302 ->
-                     let headers = read_rest_of_headers ic in
                      let newloc = List.assoc "location" headers in
                      doit newloc
                  | _ -> failwith "Unhandled response code"                 
1 file changed, 1 insertion(+), 1 deletion(-)
ocaml/xe-cli/newcli.ml |    2 +-

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

xen-api mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] fix occasional failure uploading patches, David Scott <=