Search code examples
haskelllibcurlhttp-status-code-401

Haskell curl missing content on status 401


I have some problems with the curl haskell library in the latest version 1.3.7.

Some example in Haskell:

module CurlTest where

import Network.Curl

url = "http://www.example.com/private/"
opts = [CurlFollowLocation True]

main = withCurlDo $ do
    curlGet url opts
    return ()

I run this snippet with ghci and I didn't get any output. On public sites with status-code 200 I get the page-content. With pure curl from the command-line I get the page-content even on 401 sites, as expected.

Did I miss a option for the haskell curl-call, or is it a bug? If it is a bug, is there a workaround or some curl-alternatives in haskell?

Greetings


Solution

  • I found that setting the curl option CurlFailOnError False fixed this for me.