Skip to content

Commit 42ba1f8

Browse files
committed
Add brackets in Host header of http request when relevant.
See: mirage/ocaml-cohttp#997 Signed-off-by: Benjamin Reis <benjamin.reis@vates.tech>
1 parent 950ff05 commit 42ba1f8

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Add brackets in `Host` header of http request when relevant.
2+
See: https://github.com/mirage/ocaml-cohttp/issues/997
3+
4+
diff --git i/ocaml/xapi/xapi_vm.ml w/ocaml/xapi/xapi_vm.ml
5+
index 4db86acbd..e310f5549 100644
6+
--- i/ocaml/xapi/xapi_vm.ml
7+
+++ w/ocaml/xapi/xapi_vm.ml
8+
@@ -1518,7 +1518,17 @@ let rec import_inner n ~__context ~url ~sr ~full_restore ~force =
9+
Cohttp.Request.Make (Cohttp_posix_io.Unbuffered_IO) in
10+
let module Response =
11+
Cohttp.Response.Make (Cohttp_posix_io.Unbuffered_IO) in
12+
- let request = Cohttp.Request.make ~meth:`GET uri in
13+
+ let headers = Cohttp.Header.init () in
14+
+ let headers =
15+
+ Cohttp.Header.add_unless_exists headers "host"
16+
+ (match Uri.scheme uri with
17+
+ | Some "httpunix" -> ""
18+
+ | _ -> (
19+
+ (Http.Url.maybe_wrap_IPv6_literal (Uri.host_with_default ~default:"localhost" uri))
20+
+ ^
21+
+ match Uri.port uri with Some p -> ":" ^ string_of_int p | None -> ""))
22+
+ in
23+
+ let request = Cohttp.Request.make ~meth:`GET ?headers:(Some headers) uri in
24+
let ic =
25+
{
26+
Cohttp_posix_io.Unbuffered_IO.header_buffer= None

SPECS/xapi.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Summary: xapi - xen toolstack for XCP
1919
Name: xapi
2020
Version: 23.31.0
21-
Release: 1.1%{?xsrel}%{?dist}
21+
Release: 1.2%{?xsrel}%{?dist}
2222
Group: System/Hypervisor
2323
License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception
2424
URL: http://www.xen.org
@@ -61,6 +61,7 @@ Patch1003: xapi-23.24.0-update-db-tunnel-protocol-from-other_config.XCP-ng.patch
6161
# Needed for IPv6 support. Upstream wants a better fix. Drop when upstream fixed it.
6262
Patch1004: xapi-23.3.0-filter-link-local-address-ipv6.XCP-ng.patch
6363
Patch1005: xapi-23.31.0-extend-uefi-cert-api.patch
64+
Patch1006: xapi-23.31.0-fix-ipv6-import.XCP-ng.patch
6465

6566
%{?_cov_buildrequires}
6667
BuildRequires: ocaml-ocamldoc
@@ -1340,6 +1341,9 @@ Coverage files from unit tests
13401341
%{?_cov_results_package}
13411342

13421343
%changelog
1344+
* Thu Feb 08 2024 Benjamin Reis <benjamin.reis@vates.tech> - 23.31.0-1.2
1345+
- Add xapi-23.31.0-fix-ipv6-import.XCP-ng.patch
1346+
13431347
* Mon Jan 22 2024 Samuel Verschelde <stormi-xcp@ylix.fr> - 23.31.0-1.1
13441348
- Rebase on 23.31.0-1
13451349
- Rediff patches (Benjamin Reis)

0 commit comments

Comments
 (0)