Lua-cURL / Lua-cURLv3

Lua binding to libcurl
MIT License
279 stars 64 forks source link

Help with NTLM authentication #155

Closed rnalrd closed 4 years ago

rnalrd commented 4 years ago

Hi,

I'm trying to get NTLM authentication to work:

local cURL = require "cURL"

local URLtest = "http://local.site/search"
local user = "testuser:password"

local c = cURL.easy() 

c:setopt {
  url = URLtest,
  post = true,
  writefunction = io.write,
  username = user,
  postfields = '{}',
--  httpauth = true,
  [cURL.AUTH_NTLM] = true
}

c:perform():close()

The output is:

/usr/bin/lua5.3: [CURL-EASY][UNKNOWN_OPTION] An unknown option was passed in to libcurl (48)

If I change the last option to:

[cURL.NTLM] = true

the error is:

/usr/bin/lua5.3: ./ntlmtest:17: table index is nil

I'm currently using version 0.3.8.

I could not find any documentation or examples about using NTLM authentication. httpauth seems to turn on just Basic auth.

Thanks for your help!

moteus commented 4 years ago

I think you have to set CURLOPT_HTTPAUTH option. httpauth = curl.AUTH_NTLM May be you need to set passwd option as whell

rnalrd commented 4 years ago

In my earlier tests with httpauth it seemed that it accepted only boolean values.

Anyway now it works, thanks!