From fadcbe8e9eb245f17d2b2ff2d847d18d54e82d17 Mon Sep 17 00:00:00 2001 From: ArthurW Date: Thu, 29 Aug 2024 18:00:38 +0200 Subject: [PATCH] fix unit tests --- cohttp/src/request.ml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cohttp/src/request.ml b/cohttp/src/request.ml index 4733401ef..87d56d44c 100644 --- a/cohttp/src/request.ml +++ b/cohttp/src/request.ml @@ -52,12 +52,11 @@ let make ?(meth = `GET) ?(version = `HTTP_1_1) ?encoding let port () = match Uri.port uri with | Some p -> ":" ^ string_of_int p - | None -> ( + | None when meth = `CONNECT -> ( match Uri_services.tcp_port_of_uri uri with - | None when meth = `CONNECT -> - failwith "A port is required for the CONNECT method." - | None -> "" + | None -> failwith "A port is required for the CONNECT method." | Some p -> ":" ^ string_of_int p) + | None -> "" in let host = match Header.get headers "host" with