From 5c3d77cde632f366bfdf9521b95648527174a2f3 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 14 Feb 2016 13:37:10 -0500 Subject: [PATCH 1/5] Ppxify all code Done automatically with https://github.com/janestreet/camlp4-to-ppx --- async/cohttp_async.ml | 6 ++--- async/cohttp_async.mli | 6 ++--- examples/async/s3_cp.ml | 6 ++--- js/cohttp_lwt_xhr.ml | 48 ++++++++++++++++++------------------ lib/accept.mli | 16 ++++++------ lib/accept_types.ml | 16 ++++++------ lib/auth.ml | 4 +-- lib/auth.mli | 4 +-- lib/body.ml | 2 +- lib/body.mli | 2 +- lib/code.ml | 18 +++++++------- lib/code.mli | 18 +++++++------- lib/conf.ml | 4 +-- lib/connection.ml | 2 +- lib/connection.mli | 2 +- lib/cookie.ml | 6 ++--- lib/cookie.mli | 4 +-- lib/header.mli | 2 +- lib/link.ml | 12 ++++----- lib/link.mli | 10 ++++---- lib/request.ml | 2 +- lib/response.ml | 2 +- lib/s.mli | 4 +-- lib/transfer.ml | 4 +-- lib/transfer.mli | 4 +-- lib_test/test_xhr.ml | 22 ++++++++--------- lwt-core/cohttp_lwt.ml | 2 +- lwt-core/cohttp_lwt_body.ml | 2 +- lwt-core/cohttp_lwt_body.mli | 2 +- lwt-core/cohttp_lwt_s.ml | 4 +-- lwt/cohttp_lwt_unix_net.ml | 2 +- lwt/cohttp_lwt_unix_net.mli | 2 +- 32 files changed, 120 insertions(+), 120 deletions(-) diff --git a/async/cohttp_async.ml b/async/cohttp_async.ml index 8f2e0868a6..94e5bdd1fd 100644 --- a/async/cohttp_async.ml +++ b/async/cohttp_async.ml @@ -88,7 +88,7 @@ module Body = struct | B.t | `Pipe of string Pipe.Reader.t ] - with sexp_of + [@@deriving sexp_of] let empty = `Empty let of_string s = ((B.of_string s) :> t) @@ -257,9 +257,9 @@ module Server = struct type ('address, 'listening_on) t = { server: ('address, 'listening_on) Tcp.Server.t sexp_opaque; - } with sexp_of + } [@@deriving sexp_of] - type response = Response.t * Body.t with sexp_of + type response = Response.t * Body.t [@@deriving sexp_of] let close t = Tcp.Server.close t.server let close_finished t = Tcp.Server.close_finished t.server diff --git a/async/cohttp_async.mli b/async/cohttp_async.mli index aef9c7b44a..60c469c6c5 100644 --- a/async/cohttp_async.mli +++ b/async/cohttp_async.mli @@ -24,7 +24,7 @@ module Body : sig type t = [ | Cohttp.Body.t | `Pipe of string Pipe.Reader.t - ] with sexp_of + ] [@@deriving sexp_of] include Cohttp.S.Body with type t := t val drain : t -> unit Deferred.t val is_empty : t -> bool Deferred.t @@ -140,13 +140,13 @@ end module Server : sig type ('address, 'listening_on) t constraint 'address = [< Socket.Address.t ] - with sexp_of + [@@deriving sexp_of] val close : (_, _) t -> unit Deferred.t val close_finished : (_, _) t -> unit Deferred.t val is_closed : (_, _) t -> bool - type response = Response.t * Body.t with sexp_of + type response = Response.t * Body.t [@@deriving sexp_of] val respond : ?flush:bool -> diff --git a/examples/async/s3_cp.ml b/examples/async/s3_cp.ml index 39df6b3b69..8afd5c2036 100644 --- a/examples/async/s3_cp.ml +++ b/examples/async/s3_cp.ml @@ -131,7 +131,7 @@ type region = [ | `Us_east_1 (* US East (N. Virginia) *) | `Us_west_1 (* US West (N. California) *) | `Us_west_2 (* US West (Oregon) *) -] with sexp +] [@@deriving sexp] let region_of_string = function | "ap-northeast-1" -> `Ap_northeast_1 @@ -169,7 +169,7 @@ let region_host_string = function type service = [ `S3 -] with sexp +] [@@deriving sexp] let string_of_service = function | `S3 -> "s3" @@ -284,7 +284,7 @@ module S3 = struct region : region; aws_access_key : string; aws_secret_key : string; - } with sexp + } [@@deriving sexp] let make_request ?body conf ~meth ~bucket ~objekt = let host_str = region_host_string conf.region in diff --git a/js/cohttp_lwt_xhr.ml b/js/cohttp_lwt_xhr.ml index 5b08a742d9..1544c6fea2 100644 --- a/js/cohttp_lwt_xhr.ml +++ b/js/cohttp_lwt_xhr.ml @@ -31,18 +31,18 @@ module Body_builder(P : Params) = struct (* perform the body transfer in chunks. *) let chunked_body text = - let body_len = text##length in + let body_len = text##.length in let pos = ref 0 in let chunkerizer () = if !pos = body_len then Lwt.return C.Transfer.Done else if !pos + P.chunk_size >= body_len then begin - let str = text##substring_toEnd(!pos) in + let str = text##(substring_toEnd (!pos)) in pos := body_len; Lwt.return (C.Transfer.Final_chunk (P.convert_body_string str)) end else begin - let str = text##substring(!pos, !pos+P.chunk_size) in + let str = text##(substring (!pos) (!pos+P.chunk_size)) in pos := !pos + P.chunk_size; Lwt.return (C.Transfer.Chunk (P.convert_body_string str)) end @@ -113,9 +113,9 @@ module Make_client_async(P : Params) = Make_api(struct let call ?headers ?body meth uri = let xml = XmlHttpRequest.create () in let (res : (Response.t Lwt.t * CLB.t) Lwt.t), wake = Lwt.task () in - let () = xml##_open(Js.string (C.Code.string_of_method meth), - Js.string (Uri.to_string uri), - Js._true) (* asynchronous call *) + let () = xml##(_open (Js.string (C.Code.string_of_method meth)) + (Js.string (Uri.to_string uri)) + (Js._true)) (* asynchronous call *) in (* set request headers *) let () = @@ -127,25 +127,25 @@ module Make_client_async(P : Params) = Make_api(struct (* some headers lead to errors in the javascript console, should we filter then out here? *) List.iter - (fun v -> xml##setRequestHeader(Js.string k, Js.string v)) v) + (fun v -> xml##(setRequestHeader (Js.string k) (Js.string v))) v) headers in - xml##onreadystatechange <- + xml##.onreadystatechange := Js.wrap_callback (fun _ -> - match xml##readyState with + match xml##.readyState with | XmlHttpRequest.DONE -> begin (* construct body *) - let body = Bb.get xml##responseText in + let body = Bb.get xml##.responseText in (* (re-)construct the response *) let response = - let resp_headers = Js.to_string (xml##getAllResponseHeaders()) in + let resp_headers = Js.to_string (xml##getAllResponseHeaders) in let channel = C.String_io.open_in resp_headers in Lwt.(Header_io.parse channel >|= fun resp_headers -> Response.make ~version:`HTTP_1_1 - ~status:(C.Code.status_of_code xml##status) + ~status:(C.Code.status_of_code xml##.status) ~flush:false (* ??? *) ~encoding:(CLB.transfer_encoding body) ~headers:resp_headers @@ -161,12 +161,12 @@ module Make_client_async(P : Params) = Make_api(struct (* perform call *) (match body with - | None -> Lwt.return (xml##send(Js.null)) + | None -> Lwt.return (xml##(send (Js.null))) | Some(body) -> CLB.to_string body >>= fun body -> - Lwt.return (xml##send(Js.Opt.return (Js.string body)))) + Lwt.return (xml##(send (Js.Opt.return (Js.string body))))) >>= fun () -> - Lwt.on_cancel res (fun () -> xml##abort ()); + Lwt.on_cancel res (fun () -> xml##abort); (* unwrap the response *) Lwt.(res >>= fun (r, b) -> r >>= fun r -> Lwt.return (r,b)) @@ -183,9 +183,9 @@ module Make_client_sync(P : Params) = Make_api(struct let call ?headers ?body meth uri = let xml = XmlHttpRequest.create () in - let () = xml##_open(Js.string (C.Code.string_of_method meth), - Js.string (Uri.to_string uri), - Js._false) (* synchronous call *) + let () = xml##(_open (Js.string (C.Code.string_of_method meth)) + (Js.string (Uri.to_string uri)) + (Js._false)) (* synchronous call *) in (* set request headers *) let () = @@ -197,27 +197,27 @@ module Make_client_sync(P : Params) = Make_api(struct (* some headers lead to errors in the javascript console, should we filter then out here? *) (fun v -> - xml##setRequestHeader(Js.string k, Js.string v)) v) + xml##(setRequestHeader (Js.string k) (Js.string v))) v) headers in (* perform call *) (match body with - | None -> Lwt.return (xml##send(Js.null)) + | None -> Lwt.return (xml##(send (Js.null))) | Some(body) -> CLB.to_string body >|= fun body -> - (xml##send(Js.Opt.return (Js.string body)))) >>= fun body -> + (xml##(send (Js.Opt.return (Js.string body))))) >>= fun body -> (* construct body *) - let body = Bb.get xml##responseText in + let body = Bb.get xml##.responseText in (* (re-)construct the response *) - let resp_headers = Js.to_string (xml##getAllResponseHeaders()) in + let resp_headers = Js.to_string (xml##getAllResponseHeaders) in Header_io.parse (C.String_io.open_in resp_headers) >>= fun resp_headers -> let response = Response.make ~version:`HTTP_1_1 - ~status:(Cohttp.Code.status_of_code xml##status) + ~status:(Cohttp.Code.status_of_code xml##.status) ~flush:false ~encoding:(CLB.transfer_encoding body) ~headers:resp_headers diff --git a/lib/accept.mli b/lib/accept.mli index 199a21dcce..da032f524c 100644 --- a/lib/accept.mli +++ b/lib/accept.mli @@ -20,10 +20,10 @@ (** Qualities are integers between 0 and 1000. A header with ["q=0.7"] corresponds to a quality of [700]. *) -type q = int with sexp +type q = int [@@deriving sexp] (** Lists, annotated with qualities. *) -type 'a qlist = (q * 'a) list with sexp +type 'a qlist = (q * 'a) list [@@deriving sexp] (** Sort by quality, biggest first. Respect the initial ordering. @@ -32,19 +32,19 @@ val qsort : 'a qlist -> 'a qlist type pv = Accept_types.pv = T of string - | S of string with sexp + | S of string [@@deriving sexp] -type p = string * pv with sexp +type p = string * pv [@@deriving sexp] type media_range = Accept_types.media_range = MediaType of string * string | AnyMediaSubtype of string - | AnyMedia with sexp + | AnyMedia [@@deriving sexp] type charset = Accept_types.charset = Charset of string - | AnyCharset with sexp + | AnyCharset [@@deriving sexp] type encoding = Accept_types.encoding = @@ -53,7 +53,7 @@ type encoding = | Compress | Deflate | Identity - | AnyEncoding with sexp + | AnyEncoding [@@deriving sexp] (** Basic language range tag. ["en-gb"] is represented as [Language ["en"; "gb"]]. @@ -61,7 +61,7 @@ type encoding = *) type language = Accept_types.language = Language of string list - | AnyLanguage with sexp + | AnyLanguage [@@deriving sexp] val media_ranges : diff --git a/lib/accept_types.ml b/lib/accept_types.ml index 0830fed8e0..a3d0d16c48 100644 --- a/lib/accept_types.ml +++ b/lib/accept_types.ml @@ -19,24 +19,24 @@ open Sexplib.Std -type pv = T of string | S of string with sexp -type p = string * pv with sexp +type pv = T of string | S of string [@@deriving sexp] +type p = string * pv [@@deriving sexp] type media_range = | MediaType of string * string | AnyMediaSubtype of string - | AnyMedia with sexp + | AnyMedia [@@deriving sexp] type charset = | Charset of string - | AnyCharset with sexp + | AnyCharset [@@deriving sexp] type encoding = | Encoding of string | Gzip | Compress | Deflate | Identity - | AnyEncoding with sexp + | AnyEncoding [@@deriving sexp] type language = | Language of string list - | AnyLanguage with sexp -type q = int with sexp -type 'a qlist = (q * 'a) list with sexp + | AnyLanguage [@@deriving sexp] +type q = int [@@deriving sexp] +type 'a qlist = (q * 'a) list [@@deriving sexp] diff --git a/lib/auth.ml b/lib/auth.ml index be1d9559b8..d96790b0a4 100644 --- a/lib/auth.ml +++ b/lib/auth.ml @@ -19,12 +19,12 @@ open Printf type challenge = [ | `Basic of string (* realm *) -] with sexp +] [@@deriving sexp] type credential = [ | `Basic of string * string (* username, password *) | `Other of string -] with sexp +] [@@deriving sexp] let string_of_credential (cred:credential) = match cred with diff --git a/lib/auth.mli b/lib/auth.mli index 2b62c202f1..a7cafa79a1 100644 --- a/lib/auth.mli +++ b/lib/auth.mli @@ -19,7 +19,7 @@ (** HTTP authentication challenge types *) type challenge = [ | `Basic of string (** Basic authentication within a realm *) -] with sexp +] [@@deriving sexp] (** HTTP authorization credential types *) type credential = [ @@ -28,7 +28,7 @@ type credential = [ | `Other of string (** An unknown credential type that will be passed straight through to the application layer *) -] with sexp +] [@@deriving sexp] (** [string_of_credential] converts the {!credential} to a string compatible with the HTTP/1.1 wire format for authorization credentials ("responses") *) diff --git a/lib/body.ml b/lib/body.ml index ff5c24341e..3f811cf587 100644 --- a/lib/body.ml +++ b/lib/body.ml @@ -20,7 +20,7 @@ type t = [ | `Empty | `String of string | `Strings of string list -] with sexp +] [@@deriving sexp] let empty = `Empty diff --git a/lib/body.mli b/lib/body.mli index 886c1b5ff1..5b198d39b7 100644 --- a/lib/body.mli +++ b/lib/body.mli @@ -22,7 +22,7 @@ type t = [ | `Empty | `String of string | `Strings of string list -] with sexp +] [@@deriving sexp] (** Signature for the core of HTTP body handling. Implementations will extend this signature to add more functions for streaming diff --git a/lib/code.ml b/lib/code.ml index ed36512bc6..917c7c5bac 100644 --- a/lib/code.ml +++ b/lib/code.ml @@ -5,7 +5,7 @@ type version = [ | `HTTP_1_0 | `HTTP_1_1 | `Other of string -] with sexp +] [@@deriving sexp] type meth = [ | `GET @@ -18,14 +18,14 @@ type meth = [ | `TRACE | `CONNECT | `Other of string -] with sexp +] [@@deriving sexp] type informational_status = [ `Continue | `Switching_protocols | `Processing | `Checkpoint - ] with sexp + ] [@@deriving sexp] type success_status = [ `OK @@ -38,7 +38,7 @@ type success_status = | `Multi_status | `Already_reported | `Im_used - ] with sexp + ] [@@deriving sexp] type redirection_status = [ `Multiple_choices @@ -50,7 +50,7 @@ type redirection_status = | `Switch_proxy | `Temporary_redirect | `Resume_incomplete - ] with sexp + ] [@@deriving sexp] type client_error_status = [ `Bad_request @@ -85,7 +85,7 @@ type client_error_status = | `Blocked_by_windows_parental_controls | `Wrong_exchange_server | `Client_closed_request - ] with sexp + ] [@@deriving sexp] type server_error_status = [ `Internal_server_error @@ -102,7 +102,7 @@ type server_error_status = | `Network_authentication_required | `Network_read_timeout_error | `Network_connect_timeout_error - ] with sexp + ] [@@deriving sexp] type status = [ | informational_status @@ -110,9 +110,9 @@ type status = [ | redirection_status | client_error_status | server_error_status -] with sexp +] [@@deriving sexp] -type status_code = [`Code of int | status ] with sexp +type status_code = [`Code of int | status ] [@@deriving sexp] let string_of_version: version -> string = function | `HTTP_1_0 -> "HTTP/1.0" diff --git a/lib/code.mli b/lib/code.mli index 326276c33c..6711dafbce 100644 --- a/lib/code.mli +++ b/lib/code.mli @@ -5,7 +5,7 @@ type version = [ | `HTTP_1_0 | `HTTP_1_1 | `Other of string -] with sexp +] [@@deriving sexp] type meth = [ | `GET @@ -18,14 +18,14 @@ type meth = [ | `TRACE | `CONNECT | `Other of string -] with sexp +] [@@deriving sexp] type informational_status = [ `Continue (** Client should continue with request *) | `Switching_protocols (** Server is switching protocols *) | `Processing (** Server has received and is processing the request *) | `Checkpoint (** resume aborted PUT or POST requests *) - ] with sexp + ] [@@deriving sexp] (** Informational *) type success_status = @@ -39,7 +39,7 @@ type success_status = | `Multi_status (** XML, can contain multiple separate responses *) | `Already_reported (** results previously returned *) | `Im_used (** request fulfilled, reponse is instance-manipulations *) - ] with sexp + ] [@@deriving sexp] (** Success *) type redirection_status = @@ -52,7 +52,7 @@ type redirection_status = | `Switch_proxy (** subsequent requests should use the specified proxy *) | `Temporary_redirect (** connect again to different URI as provided *) | `Resume_incomplete (** resumable HTTP requests *) - ] with sexp + ] [@@deriving sexp] (** Redirection *) type client_error_status = @@ -88,7 +88,7 @@ type client_error_status = | `Blocked_by_windows_parental_controls (** Windows Parental Controls blocking access to webpage *) | `Wrong_exchange_server (** The server cannot reach the client's mailbox. *) | `Client_closed_request (** connection closed by client while HTTP server is processing *) - ] with sexp + ] [@@deriving sexp] (** Client_error *) type server_error_status = @@ -106,7 +106,7 @@ type server_error_status = | `Network_authentication_required (** client needs to authenticate to gain network access *) | `Network_read_timeout_error (** network read timeout behind the proxy *) | `Network_connect_timeout_error (** network connect timeout behind the proxy *) - ] with sexp + ] [@@deriving sexp] (** Server_error *) type status = [ @@ -115,9 +115,9 @@ type status = [ | redirection_status | client_error_status | server_error_status -] with sexp +] [@@deriving sexp] -type status_code = [`Code of int | status ] with sexp +type status_code = [`Code of int | status ] [@@deriving sexp] val string_of_version: version -> string (** Convert a version to a string. *) diff --git a/lib/conf.ml b/lib/conf.ml index 237257951e..8582c1a4f7 100644 --- a/lib/conf.ml +++ b/lib/conf.ml @@ -15,5 +15,5 @@ * *) -let user_agent = "ocaml-cohttp/0.19.2" -let version = "0.19.2" +let user_agent = "ocaml-cohttp/0.19.3" +let version = "0.19.3" diff --git a/lib/connection.ml b/lib/connection.ml index 04a0f51831..12223fcad1 100644 --- a/lib/connection.ml +++ b/lib/connection.ml @@ -16,7 +16,7 @@ }}}*) open Sexplib.Std -type t = int with sexp +type t = int [@@deriving sexp] let to_string = string_of_int diff --git a/lib/connection.mli b/lib/connection.mli index 2b5dd6ad0d..19c900cfc5 100644 --- a/lib/connection.mli +++ b/lib/connection.mli @@ -17,7 +17,7 @@ (** Connection identifiers. *) -type t with sexp +type t [@@deriving sexp] (** Abstract type for connection identifiers. *) val create : unit -> t diff --git a/lib/cookie.ml b/lib/cookie.ml index a787a3a95c..8b9186e195 100644 --- a/lib/cookie.ml +++ b/lib/cookie.ml @@ -20,9 +20,9 @@ open Sexplib.Std type expiration = [ | `Session | `Max_age of int64 -] with sexp +] [@@deriving sexp] -type cookie = string * string with sexp +type cookie = string * string [@@deriving sexp] module Set_cookie_hdr = struct type t = { @@ -31,7 +31,7 @@ module Set_cookie_hdr = struct domain : string option; path : string option; secure : bool; - http_only: bool } with fields, sexp + http_only: bool } [@@deriving fields, sexp] (* Does not check the contents of name or value for ';', ',', '\s', or name[0]='$' *) let make ?(expiration=`Session) ?path ?domain ?(secure=false) ?(http_only=false) cookie = diff --git a/lib/cookie.mli b/lib/cookie.mli index 767e4f0713..ba46d27091 100644 --- a/lib/cookie.mli +++ b/lib/cookie.mli @@ -29,7 +29,7 @@ type expiration = [ | `Max_age of int64 (** The value of the Max-Age attribute is delta-seconds, the lifetime of the cookie in seconds, a decimal non-negative integer. *) -] with sexp +] [@@deriving sexp] type cookie = string * string (** A cookie is simply a key/value pair send from the client to the server *) @@ -41,7 +41,7 @@ module Set_cookie_hdr : sig domain : string option; path : string option; secure : bool; - http_only : bool } with fields, sexp + http_only : bool } [@@deriving fields, sexp] (** A header which a server sends to a client to request that the client returns the cookie in future requests, under certain conditions. *) diff --git a/lib/header.mli b/lib/header.mli index 07035d03cb..52583469df 100644 --- a/lib/header.mli +++ b/lib/header.mli @@ -17,7 +17,7 @@ (** Map of HTTP header key and value(s) associated with them. Since HTTP headers can contain duplicate keys, this structure can return a list of values associated with a single key. *) -type t with sexp +type t [@@deriving sexp] (** Construct a fresh, empty map of HTTP headers *) val init : unit -> t diff --git a/lib/link.ml b/lib/link.ml index 1bc0498ee8..3d63d9bf25 100644 --- a/lib/link.ml +++ b/lib/link.ml @@ -59,7 +59,7 @@ module Rel = struct | Via | Working_copy | Working_copy_of - with sexp + [@@deriving sexp] let extension uri = Extension uri let alternate = Alternate @@ -105,7 +105,7 @@ end module Language = struct type t = string - with sexp + [@@deriving sexp] let to_string x = x let of_string x = x @@ -113,7 +113,7 @@ end module Charset = struct type t = string - with sexp + [@@deriving sexp] let to_string x = x let of_string x = x @@ -124,7 +124,7 @@ module Ext = struct charset : Charset.t; language : Language.t; value : 'a; - } with sexp, fields + } [@@deriving sexp, fields] let make ?(charset="") ?(language="") value = { charset; language; value } @@ -142,7 +142,7 @@ module Arc = struct media_type : (string * string) option; extensions : (string * string) list; extension_exts : (string * string Ext.t) list; - } with sexp + } [@@deriving sexp] let empty = { reverse = false; @@ -163,7 +163,7 @@ type t = { arc : Arc.t; target : Uri.t; } -with sexp +[@@deriving sexp] (* TODO: this could be replaced with empty t/arc fupdate *) type param = diff --git a/lib/link.mli b/lib/link.mli index f269b9f60a..5b6d72739d 100644 --- a/lib/link.mli +++ b/lib/link.mli @@ -18,7 +18,7 @@ Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters") *) module Rel : sig - type t with sexp + type t [@@deriving sexp] val extension : Uri.t -> t val alternate : t @@ -63,21 +63,21 @@ module Rel : sig end module Language : sig - type t = private string with sexp + type t = private string [@@deriving sexp] val to_string : t -> string val of_string : string -> t end module Charset : sig - type t = private string with sexp + type t = private string [@@deriving sexp] val to_string : t -> string val of_string : string -> t end module Ext : sig - type 'a t with sexp + type 'a t [@@deriving sexp] val charset : 'a t -> Charset.t val language : 'a t -> Language.t @@ -108,7 +108,7 @@ type t = { context : Uri.t; arc : Arc.t; target : Uri.t; -} with sexp +} [@@deriving sexp] val empty : t diff --git a/lib/request.ml b/lib/request.ml index 7664a20cb8..704aa8f002 100644 --- a/lib/request.ml +++ b/lib/request.ml @@ -22,7 +22,7 @@ type t = { uri: Uri.t; version: Code.version; encoding: Transfer.encoding; -} with fields, sexp +} [@@deriving fields, sexp] let make ?(meth=`GET) ?(version=`HTTP_1_1) ?encoding ?headers uri = let headers = diff --git a/lib/response.ml b/lib/response.ml index fb62ef4110..69453a82fe 100644 --- a/lib/response.ml +++ b/lib/response.ml @@ -22,7 +22,7 @@ type t = { version: Code.version; status: Code.status_code; flush: bool; -} with fields, sexp +} [@@deriving fields, sexp] let make ?(version=`HTTP_1_1) ?(status=`OK) ?(flush=false) ?(encoding=Transfer.Chunked) ?headers () = let headers = match headers with None -> Header.init () |Some h -> h in diff --git a/lib/s.mli b/lib/s.mli index 923183ec0d..f684e654a5 100644 --- a/lib/s.mli +++ b/lib/s.mli @@ -87,7 +87,7 @@ module type Request = sig uri: Uri.t; (** Full HTTP request uri *) version: Code.version; (** HTTP version, usually 1.1 *) encoding: Transfer.encoding; (** transfer encoding of this HTTP request *) - } with fields, sexp + } [@@deriving fields, sexp] val make : ?meth:Code.meth -> ?version:Code.version -> ?encoding:Transfer.encoding -> ?headers:Header.t -> @@ -109,7 +109,7 @@ module type Response = sig version: Code.version; (** (** HTTP version, usually 1.1 *) *) status: Code.status_code; (** HTTP status code of the response *) flush: bool; - } with fields, sexp + } [@@deriving fields, sexp] val make : ?version:Code.version -> diff --git a/lib/transfer.ml b/lib/transfer.ml index 71777b3633..1d6547aa6f 100644 --- a/lib/transfer.ml +++ b/lib/transfer.ml @@ -19,12 +19,12 @@ open Sexplib.Std type encoding = | Chunked | Fixed of int64 - | Unknown with sexp + | Unknown [@@deriving sexp] type chunk = | Chunk of string | Final_chunk of string - | Done with sexp + | Done [@@deriving sexp] let string_of_encoding = function diff --git a/lib/transfer.mli b/lib/transfer.mli index 49008b00b4..a3701e09d0 100644 --- a/lib/transfer.mli +++ b/lib/transfer.mli @@ -24,14 +24,14 @@ type encoding = | Chunked (** dynamic chunked encoding *) | Fixed of int64 (** fixed size content *) | Unknown (** unknown body size, which leads to best-effort *) -with sexp +[@@deriving sexp] (** A chunk of body that also signals if there to more to arrive *) type chunk = | Chunk of string (** chunk of data and not the end of stream *) | Final_chunk of string (** the last chunk of data, so no more should be read *) | Done (** no more body data is present *) -with sexp +[@@deriving sexp] (** Convert the encoding format to a human-readable string *) val string_of_encoding : encoding -> string diff --git a/lib_test/test_xhr.ml b/lib_test/test_xhr.ml index 3f8a7932ad..c3da02129f 100644 --- a/lib_test/test_xhr.ml +++ b/lib_test/test_xhr.ml @@ -61,13 +61,13 @@ end) *) let get_element e = let d = Dom_html.document in Js.Opt.get - (d##getElementById (Js.string e)) + (d##(getElementById (Js.string e))) (fun () -> assert false) let get_input n = match Dom_html.tagged (get_element n) with | Dom_html.Input(x) -> x | _ -> failwith ("couldn't find text element" ^ n) -let value n = Js.to_string (get_input n)##value +let value n = Js.to_string (get_input n)##.value (* JSON object used for pretty printing result *) type json_object @@ -76,7 +76,7 @@ class type json = object method stringify : json_object Js.t -> unit Js.opt -> int -> Js.js_string Js.t Js.meth end let json : json Js.t = Js.Unsafe.variable "JSON" -let pretty str = json##stringify(json##parse(Js.string str), Js.null, 2) +let pretty str = json##(stringify (json##(parse (Js.string str))) (Js.null) (2)) let main _ = let counter = get_element "counter" in @@ -97,15 +97,15 @@ let main _ = add Cohttp.(Code.(string_of_status resp.Response.status)); Cohttp.Header.iter (fun k v -> List.iter (fun v -> add (k ^ ": " ^ v)) v) resp.Cohttp.Response.headers; - output_response1##innerHTML <- Js.string (Buffer.contents b); + output_response1##.innerHTML := Js.string (Buffer.contents b); (* show the body as pretty printed json *) Cohttp_lwt_body.to_string body >>= fun body -> - output_response2##innerHTML <- pretty body; + output_response2##.innerHTML := pretty body; Lwt.return ()); Js._false in - list_repos##onclick <- Dom_html.handler run_query; + list_repos##.onclick := Dom_html.handler run_query; (* Download a file from test_net_lwt_server.native * There is an issue here with _build/lib_test/test_xhr.byte @@ -147,25 +147,25 @@ let main _ = in read_stream 0 None >>= fun (length, data) -> let data = match data with None -> "" | Some(data) -> data in - output_response1##innerHTML <- Js.string (Printf.sprintf "blob size = %i\n" length); - output_response2##innerHTML <- Js.bytestring data; + output_response1##.innerHTML := Js.string (Printf.sprintf "blob size = %i\n" length); + output_response2##.innerHTML := Js.bytestring data; Lwt.return ()); Js._false in - download_blob##onclick <- Dom_html.handler run_download; + download_blob##.onclick := Dom_html.handler run_download; (* run a quickly updating counter - * we want to avoid long pauses and this helps up see them *) let set_counter = let r = ref 0 in (fun () -> - incr r; counter##innerHTML <- Js.string (string_of_int !r)) + incr r; counter##.innerHTML := Js.string (string_of_int !r)) in let rec f() = set_counter (); Lwt.( Lwt_js.sleep 0.1 >>= f ) in let _ = f() in Js._false -let _ = Dom_html.window##onload <- Dom_html.handler main +let _ = Dom_html.window##.onload := Dom_html.handler main diff --git a/lwt-core/cohttp_lwt.ml b/lwt-core/cohttp_lwt.ml index fc99d24067..4b5b58184d 100644 --- a/lwt-core/cohttp_lwt.ml +++ b/lwt-core/cohttp_lwt.ml @@ -48,7 +48,7 @@ module Make_client module Response = Make_response(IO) module Request = Make_request(IO) - type ctx = Net.ctx with sexp_of + type ctx = Net.ctx [@@deriving sexp_of] let default_ctx = Net.default_ctx let read_response ~closefn ic oc meth = diff --git a/lwt-core/cohttp_lwt_body.ml b/lwt-core/cohttp_lwt_body.ml index 4385e212a5..df277933de 100644 --- a/lwt-core/cohttp_lwt_body.ml +++ b/lwt-core/cohttp_lwt_body.ml @@ -22,7 +22,7 @@ open Sexplib.Conv type t = [ | Body.t | `Stream of string Lwt_stream.t sexp_opaque -] with sexp +] [@@deriving sexp] let empty = (Body.empty :> t) diff --git a/lwt-core/cohttp_lwt_body.mli b/lwt-core/cohttp_lwt_body.mli index 8f45334349..f68cd34411 100644 --- a/lwt-core/cohttp_lwt_body.mli +++ b/lwt-core/cohttp_lwt_body.mli @@ -17,7 +17,7 @@ type t = [ | Cohttp.Body.t | `Stream of string Lwt_stream.t -] with sexp +] [@@deriving sexp] include Cohttp.S.Body with type t := t diff --git a/lwt-core/cohttp_lwt_s.ml b/lwt-core/cohttp_lwt_s.ml index 77e0752113..71c6ccbd88 100644 --- a/lwt-core/cohttp_lwt_s.ml +++ b/lwt-core/cohttp_lwt_s.ml @@ -12,7 +12,7 @@ module type IO = S.IO with type 'a t = 'a Lwt.t and close the resulting channels to clean up. *) module type Net = sig module IO : IO - type ctx with sexp_of + type ctx [@@deriving sexp_of] val default_ctx: ctx val connect_uri : ctx:ctx -> Uri.t -> (IO.conn * IO.ic * IO.oc) Lwt.t val close_in : IO.ic -> unit @@ -28,7 +28,7 @@ end up, but this can take some additional time to happen. *) module type Client = sig - type ctx with sexp_of + type ctx [@@deriving sexp_of] val default_ctx : ctx (** [call ?ctx ?headers ?body ?chunked meth uri] will resolve the diff --git a/lwt/cohttp_lwt_unix_net.ml b/lwt/cohttp_lwt_unix_net.ml index 346c849098..59f8d04c26 100644 --- a/lwt/cohttp_lwt_unix_net.ml +++ b/lwt/cohttp_lwt_unix_net.ml @@ -24,7 +24,7 @@ module IO = Cohttp_lwt_unix_io type ctx = { ctx: Conduit_lwt_unix.ctx; resolver: Resolver_lwt.t; -} with sexp_of +} [@@deriving sexp_of] let init ?(ctx=Conduit_lwt_unix.default_ctx) ?(resolver=Resolver_lwt_unix.system) () = diff --git a/lwt/cohttp_lwt_unix_net.mli b/lwt/cohttp_lwt_unix_net.mli index df6dc7082c..ba157cca30 100644 --- a/lwt/cohttp_lwt_unix_net.mli +++ b/lwt/cohttp_lwt_unix_net.mli @@ -25,7 +25,7 @@ module IO : Cohttp.S.IO type ctx = { ctx : Conduit_lwt_unix.ctx; resolver : Resolver_lwt.t; -} with sexp_of +} [@@deriving sexp_of] val init : ?ctx:Conduit_lwt_unix.ctx -> ?resolver:Resolver_lwt.t -> unit -> ctx From a996ab60a7fc5c3ef79e132ffea98e7d8c71a5eb Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 14 Feb 2016 13:37:25 -0500 Subject: [PATCH 2/5] Update _oasis and opam to reflect ppx packages --- _oasis | 9 ++++----- opam | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/_oasis b/_oasis index 3924b972ac..07fb595ace 100644 --- a/_oasis +++ b/_oasis @@ -28,9 +28,8 @@ Library cohttp Modules: S, Code, Header, Cookie, Request, Response, Transfer, Accept, Accept_parser, Accept_lexer, Accept_types, Link, Auth, Header_io, Transfer_io, Connection, Body, String_io, Conf - BuildDepends: re.emacs, stringext, uri (>= 1.5.0), uri.services, - fieldslib (>= 109.20.00), pa_fields_conv, - sexplib (>= 109.53.00), pa_sexp_conv, + BuildDepends: re.emacs, stringext, uri (>= 1.5.0), uri.services, fieldslib, + sexplib, ppx_fields_conv, ppx_sexp_conv, bytes, base64 (>= 2.0.0) XMETARequires: re.emacs, stringext, uri, uri.services, fieldslib, sexplib, bytes, base64 @@ -107,7 +106,7 @@ Library cohttp_lwt_xhr Path: js Findlibname: js FindlibParent: cohttp - BuildDepends: cohttp.lwt-core, js_of_ocaml, js_of_ocaml.syntax + BuildDepends: cohttp.lwt-core, js_of_ocaml, js_of_ocaml.ppx XMETARequires: cohttp.lwt-core, js_of_ocaml Modules: Cohttp_lwt_xhr @@ -388,7 +387,7 @@ Executable "test_xhr" Custom: true CompiledObject: byte Install: false - BuildDepends: cohttp, cohttp.js, js_of_ocaml.syntax + BuildDepends: cohttp, cohttp.js, js_of_ocaml.ppx Executable "async-receive-post" Path: examples/async diff --git a/opam b/opam index e65f08e8ce..8b5075e330 100644 --- a/opam +++ b/opam @@ -31,10 +31,9 @@ depends: [ "uri" {>= "1.9.0"} "fieldslib" "sexplib" - "type_conv" - "pa_sexp_conv" - "pa_fields_conv" "conduit" {>= "0.11.0"} + "ppx_fields_conv" + "ppx_sexp_conv" "stringext" "base64" {>= "2.0.0"} "magic-mime" From 26d57e9af098e921369fe1bc9e5569be7c6f04ed Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 14 Feb 2016 13:37:35 -0500 Subject: [PATCH 3/5] Regenerate oasis --- _tags | 156 ++++++++++++++++++++++++------------------------ myocamlbuild.ml | 4 +- setup.ml | 22 +++---- 3 files changed, 88 insertions(+), 94 deletions(-) diff --git a/_tags b/_tags index a6783dc021..eae6860864 100644 --- a/_tags +++ b/_tags @@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: f6491da743f431d48323958ce13f300e) +# DO NOT EDIT (digest: b221c79d0cfd15f2c79e08c268452a4f) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -41,8 +41,8 @@ true: annot, bin_annot : pkg_bytes : pkg_fieldslib : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -58,8 +58,8 @@ true: annot, bin_annot : pkg_bytes : pkg_fieldslib : pkg_lwt -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -74,10 +74,10 @@ true: annot, bin_annot : pkg_bytes : pkg_fieldslib : pkg_js_of_ocaml -: pkg_js_of_ocaml.syntax +: pkg_js_of_ocaml.ppx : pkg_lwt -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -97,8 +97,8 @@ true: annot, bin_annot : pkg_lwt.unix : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -118,8 +118,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -138,8 +138,8 @@ true: annot, bin_annot : pkg_lwt.unix : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -155,8 +155,8 @@ true: annot, bin_annot : pkg_bytes : pkg_fieldslib : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -170,8 +170,8 @@ true: annot, bin_annot : pkg_bytes : pkg_fieldslib : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -185,8 +185,8 @@ true: annot, bin_annot : pkg_bytes : pkg_fieldslib : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -204,8 +204,8 @@ true: annot, bin_annot : pkg_lwt.unix : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -225,8 +225,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -245,8 +245,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -265,8 +265,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -285,8 +285,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -305,8 +305,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -325,8 +325,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -345,8 +345,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -364,8 +364,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -383,8 +383,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -402,8 +402,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -421,8 +421,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -446,8 +446,8 @@ true: annot, bin_annot : pkg_conduit.async : pkg_fieldslib : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -464,8 +464,8 @@ true: annot, bin_annot : pkg_conduit.async : pkg_fieldslib : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -488,8 +488,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -509,8 +509,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -530,8 +530,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -549,8 +549,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -568,8 +568,8 @@ true: annot, bin_annot : pkg_conduit.async : pkg_fieldslib : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -588,8 +588,8 @@ true: annot, bin_annot : pkg_fieldslib : pkg_magic-mime : pkg_nocrypto -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -606,10 +606,10 @@ true: annot, bin_annot "lib_test/test_xhr.byte": pkg_bytes "lib_test/test_xhr.byte": pkg_fieldslib "lib_test/test_xhr.byte": pkg_js_of_ocaml -"lib_test/test_xhr.byte": pkg_js_of_ocaml.syntax +"lib_test/test_xhr.byte": pkg_js_of_ocaml.ppx "lib_test/test_xhr.byte": pkg_lwt -"lib_test/test_xhr.byte": pkg_pa_fields_conv -"lib_test/test_xhr.byte": pkg_pa_sexp_conv +"lib_test/test_xhr.byte": pkg_ppx_fields_conv +"lib_test/test_xhr.byte": pkg_ppx_sexp_conv "lib_test/test_xhr.byte": pkg_re.emacs "lib_test/test_xhr.byte": pkg_sexplib "lib_test/test_xhr.byte": pkg_stringext @@ -619,7 +619,7 @@ true: annot, bin_annot "lib_test/test_xhr.byte": use_cohttp_lwt "lib_test/test_xhr.byte": use_cohttp_lwt_xhr : pkg_js_of_ocaml -: pkg_js_of_ocaml.syntax +: pkg_js_of_ocaml.ppx : use_cohttp_lwt_xhr "lib_test/test_xhr.byte": custom # Executable async-receive-post @@ -629,8 +629,8 @@ true: annot, bin_annot : pkg_conduit.async : pkg_fieldslib : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -645,8 +645,8 @@ true: annot, bin_annot : pkg_conduit.async : pkg_fieldslib : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -664,8 +664,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -684,8 +684,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -702,8 +702,8 @@ true: annot, bin_annot : pkg_lwt : pkg_lwt.unix : pkg_magic-mime -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -723,8 +723,8 @@ true: annot, bin_annot : pkg_lwt.unix : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext @@ -744,8 +744,8 @@ true: annot, bin_annot : pkg_lwt.unix : pkg_magic-mime : pkg_oUnit -: pkg_pa_fields_conv -: pkg_pa_sexp_conv +: pkg_ppx_fields_conv +: pkg_ppx_sexp_conv : pkg_re.emacs : pkg_sexplib : pkg_stringext diff --git a/myocamlbuild.ml b/myocamlbuild.ml index c20d18e954..0f016188e3 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -337,9 +337,7 @@ module MyOCamlbuildFindlib = struct "camlp4.mapgenerator"; "camlp4.metagenerator"; "camlp4.profiler"; - "camlp4.tracer"; - "pa_sexp_conv"; - "pa_fields_conv" + "camlp4.tracer" ] diff --git a/setup.ml b/setup.ml index 24ddf73918..75066b1e06 100644 --- a/setup.ml +++ b/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.4.5 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 2cb6a7924af84800b46bb9b07e32ab93) *) +(* DO NOT EDIT (digest: 07c7591cbfbc42ef31dc58dd04544a48) *) (* Regenerated by OASIS v0.4.5 Visit http://oasis.forge.ocamlcore.org for more information and @@ -7092,14 +7092,10 @@ let setup_t = ("uri", Some (OASISVersion.VGreaterEqual "1.5.0")); FindlibPackage ("uri.services", None); - FindlibPackage - ("fieldslib", - Some (OASISVersion.VGreaterEqual "109.20.00")); - FindlibPackage ("pa_fields_conv", None); - FindlibPackage - ("sexplib", - Some (OASISVersion.VGreaterEqual "109.53.00")); - FindlibPackage ("pa_sexp_conv", None); + FindlibPackage ("fieldslib", None); + FindlibPackage ("sexplib", None); + FindlibPackage ("ppx_fields_conv", None); + FindlibPackage ("ppx_sexp_conv", None); FindlibPackage ("bytes", None); FindlibPackage ("base64", @@ -7438,7 +7434,7 @@ let setup_t = [ InternalLibrary "cohttp_lwt"; FindlibPackage ("js_of_ocaml", None); - FindlibPackage ("js_of_ocaml.syntax", None) + FindlibPackage ("js_of_ocaml.ppx", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"]; bs_c_sources = []; @@ -8561,7 +8557,7 @@ let setup_t = [ InternalLibrary "cohttp"; InternalLibrary "cohttp_lwt_xhr"; - FindlibPackage ("js_of_ocaml.syntax", None) + FindlibPackage ("js_of_ocaml.ppx", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"]; bs_c_sources = []; @@ -8890,7 +8886,7 @@ let setup_t = }; oasis_fn = Some "_oasis"; oasis_version = "0.4.5"; - oasis_digest = Some " &\130Ò\tó_¸\031Eð\029W#\157ò"; + oasis_digest = Some "Ízòß\006G\135;%ü\159Ó\019\134w("; oasis_exec = None; oasis_setup_args = []; setup_update = false @@ -8898,6 +8894,6 @@ let setup_t = let setup () = BaseSetup.setup setup_t;; -# 8902 "setup.ml" +# 8898 "setup.ml" (* OASIS_STOP *) let () = setup ();; From 845c18a8ee565253cf1d6ee0190d48fab345f17c Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 14 Feb 2016 14:02:37 -0500 Subject: [PATCH 4/5] Constraint jsoo to >= 2.6 Minimum version providing ppx @Drup --- opam | 1 + 1 file changed, 1 insertion(+) diff --git a/opam b/opam index 8b5075e330..3635d80f4a 100644 --- a/opam +++ b/opam @@ -44,5 +44,6 @@ depopts: ["async" "lwt" "js_of_ocaml"] conflicts: [ "async" {< "113.24.00"} "lwt" {< "2.5.0"} + "js_of_ocaml" {< "2.6"} ] available: [ocaml-version >= "4.01.0"] From 3bb887abe9bd4ac65dec598316d96a1dc3ccb30a Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sat, 26 Mar 2016 21:33:37 -0400 Subject: [PATCH 5/5] explicit newlines in string constants --- lib_test/test_net_async_server.ml | 10 +-- lib_test/test_parser.ml | 110 +++++++++++++++--------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/lib_test/test_net_async_server.ml b/lib_test/test_net_async_server.ml index 9f86929198..b31bb58623 100644 --- a/lib_test/test_net_async_server.ml +++ b/lib_test/test_net_async_server.ml @@ -33,11 +33,11 @@ let handler ~body sock req = (* Get a list of current files and map to HTML *) List.map ls_dir ~f:(fun f -> sprintf "
  • /%s
  • " f f) |> String.concat ~sep:"\n" - |> sprintf "
      -
    • /hello
    • -
    • /hellopipe
    • -
    • timer
    • -
    • Files
    • + |> sprintf "" |> Server.respond_with_string | "/post" -> diff --git a/lib_test/test_parser.ml b/lib_test/test_parser.ml index 53f8e1d64a..dfbdddf273 100644 --- a/lib_test/test_parser.ml +++ b/lib_test/test_parser.ml @@ -21,76 +21,76 @@ let basic_req = "GET /index.html HTTP/1.1\r\nHost: www.example.com\r\n\r\n" let basic_res = -"HTTP/1.1 200 OK -Date: Mon, 23 May 2005 22:38:34 GMT -Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) -Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT -Etag: \"3f80f-1b6-3e1cb03b\" -Accept-Ranges: none -Content-Length: 0 -Connection: close +"HTTP/1.1 200 OK\r\n\ +Date: Mon, 23 May 2005 22:38:34 GMT\r\n\ +Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)\r\n\ +Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT\r\n\ +Etag: \"3f80f-1b6-3e1cb03b\"\r\n\ +Accept-Ranges: none\r\n\ +Content-Length: 0\r\n\ +Connection: close\r\n\ Content-Type: text/html; charset=UTF-8" let basic_res_content = -"HTTP/1.1 200 OK -Date: Mon, 23 May 2005 22:38:34 GMT -Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) -Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT -Etag: \"3f80f-1b6-3e1cb03b\" -Accept-Ranges: none -Content-Length: 32 -Connection: close -Content-Type: text/html; charset=UTF-8 - +"HTTP/1.1 200 OK\r\n\ +Date: Mon, 23 May 2005 22:38:34 GMT\r\n\ +Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)\r\n\ +Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT\r\n\ +Etag: \"3f80f-1b6-3e1cb03b\"\r\n\ +Accept-Ranges: none\r\n\ +Content-Length: 32\r\n\ +Connection: close\r\n\ +Content-Type: text/html; charset=UTF-8\r\n\ +\r\n\ home=Cosby&favorite+flavor=flies" let post_req = -"POST /path/script.cgi HTTP/1.0 -From: frog@jmarshall.com -User-Agent: HTTPTool/1.0 -Content-Type: application/x-www-form-urlencoded -Content-Length: 32 - +"POST /path/script.cgi HTTP/1.0\r\n\ +From: frog@jmarshall.com\r\n\ +User-Agent: HTTPTool/1.0\r\n\ +Content-Type: application/x-www-form-urlencoded\r\n\ +Content-Length: 32\r\n\ +\r\n\ home=Cosby&favorite+flavor=flies" let post_data_req = -"POST /path/script.cgi HTTP/1.0 -From: frog@jmarshall.com -User-Agent: HTTPTool/1.0 -Content-Length: 32 - +"POST /path/script.cgi HTTP/1.0\r\n\ +From: frog@jmarshall.com\r\n\ +User-Agent: HTTPTool/1.0\r\n\ +Content-Length: 32\r\n\ +\r\n\ home=Cosby&favorite+flavor=flies" let post_chunked_req = -"POST /foo HTTP/1.1 -Date: Fri, 31 Dec 1999 23:59:59 GMT -Content-Type: text/plain -Transfer-Encoding: chunked - -1a; ignore-stuff-here -abcdefghijklmnopqrstuvwxyz -10 -1234567890abcdef -0 -some-footer: some-value -another-footer: another-value - +"POST /foo HTTP/1.1\r\n\ +Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n\ +Content-Type: text/plain\r\n\ +Transfer-Encoding: chunked\r\n\ +\r\n\ +1a; ignore-stuff-here\r\n\ +abcdefghijklmnopqrstuvwxyz\r\n\ +10\r\n\ +1234567890abcdef\r\n\ +0\r\n\ +some-footer: some-value\r\n\ +another-footer: another-value\r\n\ +\r\n\ " let chunked_res = -"HTTP/1.1 200 OK -Date: Fri, 31 Dec 1999 23:59:59 GMT -Content-Type: text/plain -Transfer-Encoding: chunked - -1a; ignore-stuff-here -abcdefghijklmnopqrstuvwxyz -10 -1234567890abcdef -0 -some-footer: some-value -another-footer: another-value - +"HTTP/1.1 200 OK\r\n\ +Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n\ +Content-Type: text/plain\r\n\ +Transfer-Encoding: chunked\r\n\ +\r\n\ +1a; ignore-stuff-here\r\n\ +abcdefghijklmnopqrstuvwxyz\r\n\ +10\r\n\ +1234567890abcdef\r\n\ +0\r\n\ +some-footer: some-value\r\n\ +another-footer: another-value\r\n\ +\r\n\ " let basic_res_plus_crlf = basic_res ^ "\r\n\r\n"