# HG changeset patch
# User David Scott <[email protected]>
# 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 <[email protected]>

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 +-


# HG changeset patch
# User David Scott <[email protected]>
# 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 <[email protected]>

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"		    
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to