Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 426
Jan-Philip Loos Avatar asked Jan 22 '26 13:01

Jan-Philip Loos


1 Answers

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

like image 180
Jens Petersen Avatar answered Jan 25 '26 11:01

Jens Petersen