Skip to content

Commit

Permalink
Curl no longer prepends the first HTTP request header to the output (#…
Browse files Browse the repository at this point in the history
…1030)

fix for #987

Co-authored-by: Jonah Beckford <9566106-jonahbeckford@users.noreply.gitlab.com>
  • Loading branch information
jonahbeckford and Jonah Beckford committed May 12, 2024
1 parent c2b2271 commit 77fb272
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
@@ -1,5 +1,6 @@
## Unreleased

- cohttp-curl: Curl no longer prepends the first HTTP request header to the output. (jonahbeckford #1030, #987)
- cohttp-eio: client: use permissive argument type for make_generic
- cohttp-eio: Improve error handling in example server (talex5 #1023)
- cohttp-eio: Don't blow up `Server.callback` on client disconnections. (mefyl #1015)
Expand Down
3 changes: 2 additions & 1 deletion cohttp-curl/src/cohttp_curl.ml
Expand Up @@ -53,13 +53,13 @@ module Request = struct
let response_header_acc = ref [] in
let response_body = ref None in
let h = Curl.init () in
let buf = Buffer.create 128 in
Curl.setopt h (CURLOPT_URL uri);
Curl.setopt h (CURLOPT_CUSTOMREQUEST (Http.Method.to_string method_));
let () =
match headers with
| None -> ()
| Some headers ->
let buf = Buffer.create 128 in
let headers =
Http.Header.fold
(fun key value acc ->
Expand Down Expand Up @@ -120,6 +120,7 @@ module Request = struct
(match output with
| Discard -> fun s -> String.length s
| String ->
let buf = Buffer.create 128 in
response_body := Some buf;
fun s ->
Buffer.add_string buf s;
Expand Down

0 comments on commit 77fb272

Please sign in to comment.