如何捕捉一个空响应 - Curl

cURL在返回空响应时似乎没有调用writefuntion 在空响应时,responseHandler不会被调用。 那么,如何捕捉一个空响应?

 local cURL = require("cURL")

  function responseHandler(data)
        print(data)
  end

  local headers = {
    "Accept: text/*",
    "Accept-Language: en",
    "Accept-Charset: iso-8859-1,*,utf-8",
    "Cache-Control: no-cache"
  }

  local url = 'http://mydomain/path'

  c = cURL.easy{
    url            = url
    ssl_verifypeer = false,
    ssl_verifyhost = false,
    httpheader     = headers,
    writefunction  = function(data)
        responseHandler(data)
    end
  }

  c:perform()
点赞