From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 942F1801BD for ; Thu, 6 Jul 2017 19:21:14 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=shayne.fletcher.50@gmail.com; spf=Pass smtp.mailfrom=shayne.fletcher.50@gmail.com; spf=None smtp.helo=postmaster@mail-ua0-f179.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of shayne.fletcher.50@gmail.com) identity=pra; client-ip=209.85.217.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="shayne.fletcher.50@gmail.com"; x-sender="shayne.fletcher.50@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of shayne.fletcher.50@gmail.com designates 209.85.217.179 as permitted sender) identity=mailfrom; client-ip=209.85.217.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="shayne.fletcher.50@gmail.com"; x-sender="shayne.fletcher.50@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ua0-f179.google.com) identity=helo; client-ip=209.85.217.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="shayne.fletcher.50@gmail.com"; x-sender="postmaster@mail-ua0-f179.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AJ+QZLxGvCfwUa1BzYJHUM51GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ7zpMmwAkXT6L1XgUPTWs2DsrQf2rWQ6/iocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZr?= =?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8LkiFJ3Hrh4FSP30Nu18FTOX7jlDKfzpee32yUr?= =?us-ascii?q?h0sio7AZOgAMHNQo2xi7yMxmHmRrVZY2lHDhaHFnK+JNbMYOsFdC/HepwpqTcD?= =?us-ascii?q?T7X0DtZ5jRw=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DlBACocF5ZhrPZVdFcHhgHCwEXAQYBg?= =?us-ascii?q?0U/gREHhR+aTIkehECKNiiFdAKDKAdCFQEBAQEBAQEBAQEBEgEBAQgLCwgoL4I?= =?us-ascii?q?zJAGCQQECAgEjBBkBGx0BAwELBgMCBAcDNAICIgERAQUBHAYTihYBAw0Ik1uRG?= =?us-ascii?q?j+MCoFsGAUBHIMIBYNdChknDVaDHQEBAQEBBQEBAQEBARoCBhKDFYhRh32CYQE?= =?us-ascii?q?EgSwBAZ1XCAEBgU2Feow/kh5IkygUH4EVNYEsUiNeGluELiWBaiQ2iHIBAQE?= X-IPAS-Result: =?us-ascii?q?A0DlBACocF5ZhrPZVdFcHhgHCwEXAQYBg0U/gREHhR+aTIk?= =?us-ascii?q?ehECKNiiFdAKDKAdCFQEBAQEBAQEBAQEBEgEBAQgLCwgoL4IzJAGCQQECAgEjB?= =?us-ascii?q?BkBGx0BAwELBgMCBAcDNAICIgERAQUBHAYTihYBAw0Ik1uRGj+MCoFsGAUBHIM?= =?us-ascii?q?IBYNdChknDVaDHQEBAQEBBQEBAQEBARoCBhKDFYhRh32CYQEEgSwBAZ1XCAEBg?= =?us-ascii?q?U2Feow/kh5IkygUH4EVNYEsUiNeGluELiWBaiQ2iHIBAQE?= X-IronPort-AV: E=Sophos;i="5.40,318,1496095200"; d="scan'208,217";a="230728044" Received: from mail-ua0-f179.google.com ([209.85.217.179]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 06 Jul 2017 19:21:13 +0200 Received: by mail-ua0-f179.google.com with SMTP id j53so5784636uaa.2 for ; Thu, 06 Jul 2017 10:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2mg+1q20az2pPjZo0NtZxQQCJqn9rb7MALuWfujlFaw=; b=mILgE4VI8TMhRXb3/9uVzByLyZL1vFCraLoQvKoTp5M05y4qZ9fghsWo7pwgkVOD0t WrQZ6HUBUznDRmrkK91jIGP7DNPwYiiHU4rPMVrMMcvm6TyjG6cQ3Hb/Cyx6stUy7itK 97Vr3dWOwBcA4yYG9SSQDc2WqbEybMssA0cvNsq27OjK0MPYXIvADMN499BiNgGZurVL 62sSQIEytHpGgTZ3fr5ElURNc9V/skhY4FFOAzuAh4YVD6DYOb3ZpnFSlI2qx/FHmh9l z1kIU27NSrcSxx9yQ0cXz8yrPVB4zTCvrhE/Yfn9qNdUIhK7o97E5793S1LSuTPfvHRD IuYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2mg+1q20az2pPjZo0NtZxQQCJqn9rb7MALuWfujlFaw=; b=t24oaTUdefm/MEqDNx/bkdZhLI7vVdWwSleKBmbE2Pd+nLky5YpuvsNatYyRhV9AAe SVMaPQXwu8bMGDzYjCDRxLWCgJGMxPEBIMZ538CJktHEQsDFMNYtqX/V3f7h57wqQByq 1GdykM6o1euDpimOYBWPilWPJmaJzBQ7MnBwyYvsesN/JqEbhJDd4ghRN2u3G1BCqYic fXS2Pb4kRk1MsvwRe6vRoCNtKJm0sF3kxZoadNjAqz8bL/+YVv4LDsFq/CV79/+Eg0az H+JxOBZslOacUdsOvUpQa+CgvzzcvMfov+PAc5TXXwcCsrBSdavBcen5pK5AmMqv90Zd Xv3w== X-Gm-Message-State: AKS2vOxrAxUHStkAtTQwj1CcEJCcI6zK7kY9T7IRpPX/U0+1bz9AQuI/ bGD7L4iPDBXHLonAhpYCCpaYLvb7rQ== X-Received: by 10.176.24.233 with SMTP id d41mr30448512uah.23.1499361672345; Thu, 06 Jul 2017 10:21:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.81.41 with HTTP; Thu, 6 Jul 2017 10:20:51 -0700 (PDT) In-Reply-To: References: From: Shayne Fletcher Date: Thu, 6 Jul 2017 13:20:51 -0400 Message-ID: To: Yaron Minsky Cc: =?UTF-8?Q?Nicol=C3=A1s_Ojeda_B=C3=A4r?= , "caml-list@inria.fr users" Content-Type: multipart/alternative; boundary="f40304379850debf480553a95775" Subject: Re: [Caml-list] [Async / Cohttp_async] Problem getting all of the data in a response body --f40304379850debf480553a95775 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 6, 2017 at 1:37 AM, Yaron Minsky wrote: > The fact that you're ignoring the result of Pipe.iter is concerning. That > function should return a deferred that becomes determined once the > iteration is complete. It's hard to say without having a bit more of the > program, but I suspect the bug is related to that. > The following fragment seems to do the trick. ``` fun () : unit Deferred.Or_error.t -> Async_client.post ... uri >>=3D fun (_, body) -> Async.Pipe.iter ~continue_on_error:true ~f:(fun s -> Deferred.return (printf "%s" s)) (Cohttp_async.Body.to_pipe body) >>| fun () -> Ok () ```=E2=80=8B =E2=80=8BThanks again.=E2=80=8B --=20 Shayne Fletcher --f40304379850debf480553a95775 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

= On Thu, Jul 6, 2017 at 1:37 AM, Yaron Minsky <yminsky@janestreet.com= > wrote:
The fact that you're ignoring the result of Pipe.iter= is concerning. That function should return a deferred that becomes determi= ned once the iteration is complete. It's hard to say without having a b= it more of the program, but I suspect the bug is related to that.

The following fragment seems t= o do the trick.

```
=C2=A0 =C2=A0 = =C2=A0fun () : unit Deferred.Or_error.t ->
=C2=A0 =C2=A0 =C2=A0 =C2=A0Async_client.post ... uri >>=3D fun (= _, body) ->
=C2=A0 =C2=A0 =C2=A0 =C2= =A0Async.Pipe.iter
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0~continue_on_error:true
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0~f:(fun s -> Deferred.return (printf &quo= t;%s" s))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(Cohttp_async.Body.to_pipe body) >>| fun () ->
=C2=A0 =C2=A0 =C2=A0 =C2=A0Ok ()
```=E2=80=8B
=E2=80=8BThanks again.=E2=80= =8B

--
Shayne Fletcher
--f40304379850debf480553a95775--