Skip to content
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ ASYNC ?= $(shell if ocamlfind query async >/dev/null 2>&1; then echo --enable-as
JS ?= $(shell if ocamlfind query js_of_ocaml >/dev/null 2>&1; then echo --enable-js; fi)
#NETTESTS ?= --enable-tests --enable-nettests

setup.ml: _oasis
oasis setup -setup-update none

setup.bin: setup.ml
ocamlopt.opt -o $@ $< 2>/dev/null || ocamlopt -o $@ $< 2>/dev/null || ocamlc -o $@ $<
rm -f setup.cmx setup.cmi setup.o setup.cmo
Expand Down
2 changes: 2 additions & 0 deletions _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Homepage: https://github.com/mirage/ocaml-cohttp
License: ISC
Plugins: META (0.3)
BuildTools: ocamlbuild
FilesAB: lib/conf.ml.ab

Library cohttp
Path: lib
Expand All @@ -26,6 +27,7 @@ Library cohttp
Modules: S, Code, Header, Cookie, Request, Response, Transfer,
Accept, Accept_parser, Accept_lexer, Accept_types,
Auth, Header_io, Transfer_io, Connection, Body, String_io
InternalModules: Conf
BuildDepends: re.emacs, stringext, uri (>= 1.5.0), uri.services,
fieldslib (>= 109.20.00), fieldslib.syntax,
sexplib (>= 109.53.00), sexplib.syntax,
Expand Down
3 changes: 2 additions & 1 deletion _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 3a1126cc930825def71880e9cfd739d1)
# DO NOT EDIT (digest: 2a142d4ea34f0b943dc2f4ea64492657)
# 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
Expand Down Expand Up @@ -33,6 +33,7 @@ true: annot, bin_annot
"lib/connection.cmx": for-pack(Cohttp)
"lib/body.cmx": for-pack(Cohttp)
"lib/string_io.cmx": for-pack(Cohttp)
"lib/conf.cmx": for-pack(Cohttp)
<lib/*.ml{,i,y}>: pkg_base64
<lib/*.ml{,i,y}>: pkg_bytes
<lib/*.ml{,i,y}>: pkg_fieldslib
Expand Down
3 changes: 2 additions & 1 deletion lib/cohttp.mlpack
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 67e2359b5db1a02e2b140598730d1456)
# DO NOT EDIT (digest: c155920e0546031ef19fb415d7852c55)
S
Code
Header
Expand All @@ -17,4 +17,5 @@ Transfer_io
Connection
Body
String_io
Conf
# OASIS_STOP
18 changes: 18 additions & 0 deletions lib/conf.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(* -*-tuareg-*-
* Copyright (c) 2015 Christophe Troestler <Christophe.Troestler@umons.ac.be>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*)

let user_agent = "ocaml-cohttp/0.15.0"
18 changes: 18 additions & 0 deletions lib/conf.ml.ab
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(* -*-tuareg-*-
* Copyright (c) 2015 Christophe Troestler <Christophe.Troestler@umons.ac.be>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*)

let user_agent = "ocaml-cohttp/${pkg_version}"
19 changes: 19 additions & 0 deletions lib/conf.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(*
* Copyright (c) 2015 Christophe Troestler <Christophe.Troestler@umons.ac.be>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*)

val user_agent : string
(** User-Agent, including the version of this library. *)
2 changes: 1 addition & 1 deletion lib/header.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ end
module StringMap = Map.Make(LString)
type t = string list StringMap.t

let user_agent = "ocaml-cohttp" (* TODO: include version from build system *)
let user_agent = Conf.user_agent

let headers_with_list_values = List.map LString.of_string [
"accept";"accept-charset";"accept-encoding";"accept-language";
Expand Down
4 changes: 4 additions & 0 deletions lib/header.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ val add_authorization_req : t -> Auth.challenge -> t
val is_form : t -> bool

val user_agent : string
(** The User-Agent header used by this library, including the version
of cohttp. *)
val prepend_user_agent : t -> string -> t
(** Prepend [user_agent] to the product token already declared in the
"User-Agent" field (if any). *)

val connection : t -> [`Keep_alive | `Close | `Unknown of string] option
8 changes: 4 additions & 4 deletions setup.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.4.5 *)

(* OASIS_START *)
(* DO NOT EDIT (digest: 4499515f5fd925c4fa540b77b9b4cdc2) *)
(* DO NOT EDIT (digest: 1f8c95306ece78483a9ad5ebf3e52b6b) *)
(*
Regenerated by OASIS v0.4.5
Visit http://oasis.forge.ocamlcore.org for more information and
Expand Down Expand Up @@ -7045,7 +7045,7 @@ let setup_t =
pre_command = [(OASISExpr.EBool true, None)];
post_command = [(OASISExpr.EBool true, None)]
};
files_ab = [];
files_ab = ["lib/conf.ml.ab"];
sections =
[
Library
Expand Down Expand Up @@ -7112,7 +7112,7 @@ let setup_t =
"String_io"
];
lib_pack = true;
lib_internal_modules = [];
lib_internal_modules = ["Conf"];
lib_findlib_parent = None;
lib_findlib_name = Some "cohttp";
lib_findlib_containers = []
Expand Down Expand Up @@ -8396,7 +8396,7 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.4.5";
oasis_digest = Some "\"-\018�(NO7�\139H���\132�";
oasis_digest = Some "^~O\192\167\170\194\147\006\141\242Z\215p\239\131";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
Expand Down