Skip to content

Commit

Permalink
Merge pull request #626 from psafont/private/paus/otlp
Browse files Browse the repository at this point in the history
  • Loading branch information
psafont authored Feb 1, 2023
2 parents 26a0238 + f08a601 commit 501938c
Show file tree
Hide file tree
Showing 9 changed files with 295 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/upstream/conf-libcurl.2/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
opam-version: "2.0"
name: "conf-libcurl"
version: "2"
synopsis: "Virtual package relying on a libcurl system installation"
description:
"This package can only install if the libcurl is installed on the system."
maintainer: "blue-prawn"
authors: "Daniel Stenberg"
license: "BSD-like"
homepage: "http://curl.haxx.se/"
bug-reports: "https://github.com/ocaml/opam-repository/issues"
flags: conf
build: ["curl-config" "--libs"]
depexts: [
["libcurl4-gnutls-dev"] {os-family = "debian"}
["libcurl-devel"] {os-distribution = "mageia"}
["libcurl-devel" "openssl-devel"] {os-distribution = "centos"}
["curl"] {os-distribution = "nixos"}
["curl"] {os-distribution = "arch"}
["curl"] {os = "win32" & os-distribution = "cygwinports"}
["curl-dev"] {os-distribution = "alpine"}
["libcurl-devel"] {os-family = "suse"}
["libcurl-devel"] {os-distribution = "fedora"}
["libcurl-devel"] {os-distribution = "ol"}
["curl"] {os-distribution = "homebrew" & os = "macos"}
["curl"] {os-distribution = "macports" & os = "macos"}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From a92d7bbe4cd0a528ce6710f932d115d0c3f06d73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= <edwin.torok@cloud.com>
Date: Tue, 31 Jan 2023 16:35:46 +0000
Subject: [PATCH] ezcurl: allow POST with non-form data
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently ezcurl always sets CURLOPT_HTTPPOST, but that means it is not able
to send a custom body that is not a form (e.g. JSON is quite a common use-case
these days).

Add a special case: if the POST params is empty, *and* a 'content' is set, then
just set CURLOPT_POST, but not CURLOPT_HTTPPOST.

Example usage:
```
let contents = Ezjsonm.to_string json in
let config = EZ.Config.(verbose true default) in
match EZ.post ~config ~url ~params:[] ~content:(`String contents) () with
```

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
---
src/core/Ezcurl_core.ml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/core/Ezcurl_core.ml b/src/core/Ezcurl_core.ml
index 09999c3..f26216d 100644
--- a/src/core/Ezcurl_core.ml
+++ b/src/core/Ezcurl_core.ml
@@ -317,6 +317,8 @@ module Make(IO : IO)
let resp_headers_done = ref false in (* once we get "\r\n" header line *)
Curl.set_url self url;
begin match meth with
+ | POST [] when (content <> None) ->
+ Curl.set_post self true
| POST l -> Curl.set_httppost self l;
| GET -> Curl.set_httpget self true;
| PUT -> Curl.set_put self true;
34 changes: 34 additions & 0 deletions packages/upstream/ezcurl.0.2.2-1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
opam-version: "2.0"
name: "ezcurl"
version: "0.2.2-1"
synopsis: "Friendly wrapper around OCurl"
maintainer: "simon.cruanes.2007@m4x.org"
authors: "Simon Cruanes"
license: "MIT"
tags: ["curl" "web" "http" "client"]
homepage: "https://github.com/c-cube/ezcurl/"
doc: "https://c-cube.github.io/ezcurl/doc/1.2"
bug-reports: "https://github.com/c-cube/ezcurl/issues"
depends: [
"ocurl" {>= "0.8.0"}
"dune" {>= "1.0"}
"odoc" {with-doc}
"ocaml" {>= "4.03.0"}
]
build: [
["dune" "build" "@install" "-p" name "-j" jobs]
["dune" "build" "@doc" "-p" name] {with-doc}
]
patches: "001-post-non-form-data.patch"
dev-repo: "git+https://github.com/c-cube/ezcurl.git"
extra-files: [
"001-post-non-form-data.patch"
"sha256=a9acedda0b76f58e93a8641be300fca39673cee4eecbddf307c0aa9d0d4f5e43"
]
url {
src: "https://github.com/c-cube/ezcurl/archive/v0.2.2.tar.gz"
checksum: [
"md5=75eafead85b6fe5ba2652a4eb580a9a9"
"sha512=dde8178f2c06adb047b8fcecc8c14bc2c5f9f51748c725c2917f7f5d3faeff385303123eb0213c55d7f2e29dad9e8c88da1b0460fa643cfba958fbe531c097fd"
]
}
32 changes: 32 additions & 0 deletions packages/upstream/ocaml-protoc.2.3/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
opam-version: "2.0"
name: "ocaml-protoc"
version: "2.3"
synopsis: "Protobuf compiler for OCaml"
description: "Protobuf compiler for OCaml"
maintainer: "Maxime Ransan <maxime.ransan@gmail.com>"
authors: "Maxime Ransan <maxime.ransan@gmail.com>"
license: "MIT"
homepage: "https://github.com/mransan/ocaml-protoc"
bug-reports: "https://github.com/mransan/ocaml-protoc/issues"
depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "2.0"}
"stdlib-shims"
"pbrt" {= version}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
["dune" "build" "@install" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc}
]
post-messages: "The runtime library is now called \"pbrt\"."
dev-repo: "git+https://github.com/mransan/ocaml-protoc.git"
url {
src: "https://github.com/mransan/ocaml-protoc/archive/2.3.0.tar.gz"
checksum: [
"md5=14cb15d70a4ab90f692e132cbf640b11"
"sha512=063a6a6a1c267ca3e965775f18e5362a58d7a0de92bcee90e57b6004fb79106c03ad1a4c04bd2d259e8d1d0461d2e2bd0b1c7862c58f763364d1cff62bba37a3"
]
}
38 changes: 38 additions & 0 deletions packages/upstream/ocurl.0.9.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
opam-version: "2.0"
name: "ocurl"
version: "0.9.1"
synopsis: "Bindings to libcurl"
description:
"libcurl is a client-side URL transfer library, supporting HTTP and a multitude of other network protocols (FTP/SMTP/RTSP/etc). This library wrap easy synchronous API (Curl), synchronous parallel and generic asynchronous API (Curl.Multi), and provides an Lwt-enabled asynchronous interface (Curl_lwt)."
maintainer: "ygrek@autistici.org"
authors: ["Lars Nilsson" "ygrek"]
license: "MIT"
tags: ["org:ygrek" "clib:curl"]
homepage: "https://ygrek.org/p/ocurl"
doc: "https://ygrek.org/p/ocurl/api/index.html"
bug-reports: "https://github.com/ygrek/ocurl/issues"
depends: [
"ocaml" {>= "4.02.0"}
"ocamlfind" {build}
"base-unix"
"conf-libcurl"
]
depopts: ["lwt" "lwt_ppx"]
build: [
["./configure"]
[make]
[make "doc"] {with-doc}
[make "test"] {with-test}
]
install: [make "install"]
dev-repo: "git+https://github.com/ygrek/ocurl.git"
url {
src: "https://ygrek.org/p/release/ocurl/ocurl-0.9.1.tar.gz"
checksum: [
"md5=1ff6b12803fa0c6e9a4358dd29b83910"
"sha256=c65f01913270b674a0ca0f278f91bc1e368d7110e8308084bc2280b43a0bc258"
"sha512=1ec21065f67ac227efb071ad696648ab4ac488ce77db091b4f212821b863fdcb2b23b6b9d579e8878fe8f1a6b2f0ec81c2751a72a1df201ea47f016012107429"
]
mirrors:
"https://github.com/ygrek/ocurl/releases/download/0.9.1/ocurl-0.9.1.tar.gz"
}
44 changes: 44 additions & 0 deletions packages/upstream/opentelemetry-client-ocurl.0.3/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
opam-version: "2.0"
name: "opentelemetry-client-ocurl"
version: "0.3"
synopsis: "Collector client for opentelemetry, using http + ocurl"
maintainer: "the Imandra team and contributors"
authors: "the Imandra team and contributors"
license: "MIT"
homepage: "https://github.com/aestheticintegration/ocaml-opentelemetry"
bug-reports:
"https://github.com/aestheticintegration/ocaml-opentelemetry/issues"
depends: [
"dune" {>= "2.7"}
"ocaml" {>= "4.08"}
"mtime" {>= "1.4"}
"opentelemetry" {= version}
"ocaml-protoc" {>= "2.2"}
"pbrt" {>= "2.2"}
"odoc" {with-doc}
"ocurl"
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo:
"git+https://github.com/aestheticintegration/ocaml-opentelemetry.git"
url {
src:
"https://github.com/AestheticIntegration/ocaml-opentelemetry/archive/v0.3.tar.gz"
checksum: [
"md5=aa5caa75abb2dd3b8777aec10f69b220"
"sha512=63538c716f4938a756b0a2fd89edf213bc4fdd636d0f08473cd822da25f751fc3b4faf57926f45edc2e3df4bd51f04ff10e8eed205f05d8be154dcd848166443"
]
}
43 changes: 43 additions & 0 deletions packages/upstream/opentelemetry.0.3/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
opam-version: "2.0"
name: "opentelemetry"
version: "0.3"
synopsis: "Instrumentation for https://opentelemetry.io"
maintainer: "the Imandra team and contributors"
authors: "the Imandra team and contributors"
license: "MIT"
tags: ["instrumentation" "tracing" "opentelemetry" "datadog" "jaeger"]
homepage: "https://github.com/aestheticintegration/ocaml-opentelemetry"
bug-reports:
"https://github.com/aestheticintegration/ocaml-opentelemetry/issues"
depends: [
"dune" {>= "2.7"}
"ocaml" {>= "4.08"}
"ptime"
"odoc" {with-doc}
"ocaml-protoc" {>= "2.2"}
"pbrt" {>= "2.2"}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo:
"git+https://github.com/aestheticintegration/ocaml-opentelemetry.git"
url {
src:
"https://github.com/AestheticIntegration/ocaml-opentelemetry/archive/v0.3.tar.gz"
checksum: [
"md5=aa5caa75abb2dd3b8777aec10f69b220"
"sha512=63538c716f4938a756b0a2fd89edf213bc4fdd636d0f08473cd822da25f751fc3b4faf57926f45edc2e3df4bd51f04ff10e8eed205f05d8be154dcd848166443"
]
}
35 changes: 35 additions & 0 deletions packages/upstream/pbrt.2.3/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
opam-version: "2.0"
name: "pbrt"
version: "2.3"
synopsis: "Runtime library for Protobuf tooling"
description: "Runtime library for Protobuf tooling"
maintainer: "Maxime Ransan <maxime.ransan@gmail.com>"
authors: "Maxime Ransan <maxime.ransan@gmail.com>"
license: "MIT"
homepage: "https://github.com/mransan/ocaml-protoc"
bug-reports: "https://github.com/mransan/ocaml-protoc/issues"
depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "2.0"}
"stdlib-shims"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
["dune" "build" "@install" "-p" name "-j" jobs]
["dune" "runtest" "-p" "pbrt,ocaml-protoc" "-j" jobs] {with-test}
["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc}
]
post-messages: """\
Pbrt: runtime library for ocaml-protoc.

A shim library named "ocaml-protoc" still exists, to ease the
migration."""
dev-repo: "git+https://github.com/mransan/ocaml-protoc.git"
url {
src: "https://github.com/mransan/ocaml-protoc/archive/2.3.0.tar.gz"
checksum: [
"md5=14cb15d70a4ab90f692e132cbf640b11"
"sha512=063a6a6a1c267ca3e965775f18e5362a58d7a0de92bcee90e57b6004fb79106c03ad1a4c04bd2d259e8d1d0461d2e2bd0b1c7862c58f763364d1cff62bba37a3"
]
}
2 changes: 2 additions & 0 deletions packages/xs-extra/xapi.master/opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ depends: [
"ctypes"
"ctypes-foreign"
"domain-name"
"ezcurl" # testing client calls with curl
"ezxenstore"
"fmt" {with-test}
"http-svr"
Expand All @@ -30,6 +31,7 @@ depends: [
"message-switch-unix"
"mtime"
"ocaml-migrate-parsetree"
"opentelemetry-client-ocurl"
"pci"
"pciutil"
"ppx_deriving_rpc"
Expand Down

0 comments on commit 501938c

Please # to comment.