Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum supported version to OCaml 4.06 #74

Merged
merged 3 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 2 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,13 @@ opam-steps: &opam-steps
# TODO: do this based on a param
command: |
eval `opam config env`
case $OCAML_VERSION in
4.04.*|4.05.*)
echo "unsupported OCaml version for ocamlformat"
;;
*)
dune build @fmt --auto-promote
git diff --exit-code
esac
dune build @fmt --auto-promote
git diff --exit-code
- run:
name: 'Check git is clean'
command: git diff --exit-code

jobs:
OCaml-404:
docker:
- image: ocaml/opam2:debian-10-ocaml-4.04
environment:
- TERM: dumb
- OCAML_VERSION: "4.04.2"
- OPAMSOLVERTIMEOUT: "600"
<<: *opam-steps
OCaml-405:
docker:
- image: ocaml/opam2:debian-10-ocaml-4.05
environment:
- TERM: dumb
- OCAML_VERSION: "4.05.0"
<<: *opam-steps
OCaml-406:
docker:
- image: ocaml/opam2:debian-10-ocaml-4.06
Expand Down Expand Up @@ -212,18 +191,6 @@ workflows:
version: 2
build-deploy:
jobs:
- OCaml-404:
all_tests: false
filters:
branches:
ignore:
- gh-pages
- OCaml-405:
all_tests: false
filters:
branches:
ignore:
- gh-pages
- OCaml-406:
all_tests: false
filters:
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased
--------------

- h2, h2-lwt, h2-lwt-unix, h2-mirage: Remove support for versions of OCaml
lower than 4.06 ([#74](https://github.com/anmonteiro/ocaml-h2/pull/74))

0.4.0 2019-11-05
--------------

Expand Down
2 changes: 1 addition & 1 deletion h2-lwt-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.04"}
"ocaml" {>= "4.06"}
"faraday-lwt-unix"
"h2-lwt" {= version}
"dune" {>= "1.5"}
Expand Down
2 changes: 1 addition & 1 deletion h2-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.04"}
"ocaml" {>= "4.06"}
"h2" {= version}
"dune" {>= "1.5"}
"lwt"
Expand Down
2 changes: 1 addition & 1 deletion h2-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.04"}
"ocaml" {>= "4.06"}
"faraday-lwt"
"h2-lwt" {= version}
"dune" {>= "1.5"}
Expand Down
2 changes: 1 addition & 1 deletion h2.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.04"}
"ocaml" {>= "4.06"}
"dune" {>= "1.5"}
"alcotest" {with-test}
"yojson" {with-test}
Expand Down
19 changes: 9 additions & 10 deletions lib/client_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,12 @@ let handle_response_headers t respd ~end_stream active_request headers =
Respd.create_active_response response response_body
in
respd.state <-
Stream.(
Active
( (if is_open respd then
Open new_response_state
else
HalfClosed new_response_state)
, active_request ));
Active
( (if Stream.is_open respd then
Open new_response_state
else
HalfClosed new_response_state)
, active_request );
active_request.response_handler response response_body;
if end_stream then (
(* Deliver EOF to the response body, as the handler might be waiting
Expand Down Expand Up @@ -376,7 +375,7 @@ let handle_headers t ~end_stream respd headers =
| Open _ ->
respd.state <- Active (Open FullHeaders, active_request)
| HalfClosed _ ->
respd.state <- Active (Stream.(HalfClosed FullHeaders), active_request));
respd.state <- Active (HalfClosed FullHeaders, active_request));
handle_response_headers t respd ~end_stream active_request headers
| _ ->
(* Unreachable. This function is only invoked if the stream is active. *)
Expand Down Expand Up @@ -605,7 +604,7 @@ let process_data_frame t { Frame.frame_header; _ } bstr =
Scheduler.deduct_inflow t.streams payload_length;
match Scheduler.get_node t.streams stream_id with
| Some (Stream { descriptor; _ } as stream) ->
(match descriptor.Stream.state with
(match descriptor.state with
| Active
( ( Open (ActiveMessage response_info)
| HalfClosed (ActiveMessage response_info) )
Expand Down Expand Up @@ -1092,7 +1091,7 @@ let process_continuation_frame t { Frame.frame_header; _ } headers_block =
let { Frame.stream_id; flags; _ } = frame_header in
match Scheduler.find t.streams stream_id with
| Some stream ->
(match stream.Stream.state with
(match stream.state with
| Active
( ( Open (PartialHeaders partial_headers)
| HalfClosed (PartialHeaders partial_headers) )
Expand Down
12 changes: 6 additions & 6 deletions lib/server_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ let handle_headers t ~end_stream reqd active_stream headers =
else
report_stream_error t reqd.Stream.id Error.ProtocolError
else (
reqd.state <- Stream.(Active (Open FullHeaders, active_stream));
reqd.state <- Active (Open FullHeaders, active_stream);
(* From RFC7540§5.1.2:
* Streams that are in the "open" state or in either of the "half-closed"
* states count toward the maximum number of streams that an endpoint is
Expand Down Expand Up @@ -592,7 +592,7 @@ let process_data_frame t { Frame.frame_header; _ } bstr =
Scheduler.deduct_inflow t.streams payload_length;
match Scheduler.get_node t.streams stream_id with
| Some (Stream { descriptor; _ } as stream) ->
(match descriptor.Stream.state with
(match descriptor.state with
| Active (Open (ActiveMessage request_info), active_stream) ->
let request_body = Reqd.request_body descriptor in
request_info.request_body_bytes <-
Expand Down Expand Up @@ -1020,12 +1020,12 @@ let process_continuation_frame t { Frame.frame_header; _ } headers_block =
report_connection_error t Error.ProtocolError
else
match Scheduler.find t.streams stream_id with
| Some respd ->
(match respd.Stream.state with
| Some stream ->
(match stream.state with
| Active (Open (PartialHeaders partial_headers), active_stream) ->
handle_headers_block
t
respd
stream
active_stream
partial_headers
flags
Expand All @@ -1036,7 +1036,7 @@ let process_continuation_frame t { Frame.frame_header; _ } headers_block =
->
handle_trailer_headers
t
respd
stream
active_stream
partial_headers
flags
Expand Down
11 changes: 0 additions & 11 deletions lib/status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*---------------------------------------------------------------------------*)

(* If we ever drop support for OCaml < 4.06 we can use a variant of the
* following, and remove all the function forwarding.
*
* From https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec249:
*
* Prior to OCaml 4.06, there were a number of restrictions: one could only
* remove types and modules at the outermost level (not inside submodules),
* and in the case of with type the definition had to be another type
* constructor with the same type parameters. *)
(* include (Httpaf.Status : Status with type informational := [ | `Continue ]) *)

(* From RFC7540§8.1.1:
* HTTP/2 removes support for the 101 (Switching Protocols) informational
* status code ([RFC7231], Section 6.2.2). *)
Expand Down
2 changes: 1 addition & 1 deletion lib_test/test_priority.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let repeat (Scheduler.PriorityTreeNode.Connection root) queue num =
match Scheduler.PriorityQueue.pop q with
| None ->
failwith "invalid queue"
| Some ((k, (Scheduler.PriorityTreeNode.Stream p as p_node)), q') ->
| Some ((k, (Scheduler.Stream p as p_node)), q') ->
(* simulate writing 100 bytes *)
root.t_last <- p.t;
Scheduler.update_t p_node 100;
Expand Down