-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question #153
Comments
You can just swap |
I did recently a test, all it's okay now, it is working good, but returns this: Here my debug code: local https = require 'http.compat.socket'
--https = require 'ssl.https'
local ltn12 = require 'ltn12'
function tprintf(_table_, _index_, _string_, ...)
if not _table_[_index_] then
_table_[_index_] = ''
end
_table_[_index_] = _table_[_index_] .. string.format(_string_, ...)
end
local source = {}
local response = {}
local index = 1
local boundary = 'BOUNDARY--mdd4s4Sd457dOp--END'
tprintf(source, index, '--%s\r\n', boundary)
tprintf(source, index, 'Content-Disposition: form-data; name="%s"\r\n\r\n', 'text')
tprintf(source, index, '%s\r\n', 'This is a test; sendMessage();')
tprintf(source, index, '--%s\r\n', boundary)
tprintf(source, index, 'Content-Disposition: form-data; name="%s"\r\n\r\n', 'chat_id')
tprintf(source, index, '%s\r\n', "189041244")
tprintf(source, index, '--%s--\r\n', boundary)
print(boundary)
https.request {
['url'] = 'https://api.telegram.org/bot213210238:AAEP1XgZOXjIiAqDJvUEDBzBHmLqAzO3Rug/sendMessage',
['method'] = 'POST',
['headers'] = {
['Content-Type'] = ('%s; boundary=%s'):format('multipart/form-data', boundary),
['Content-Length'] = #source[index]
},
['source'] = ltn12.source.string(source[index]),
['sink'] = ltn12.sink.table(response)
}
print(table.concat(response)) Did you fixed that recently ? EDIT: I did a test compiling from source and i got the same |
Ah ha, yes that segfaults for me too! I think it's a bug in luaossl. Simply local openssl_ctx = require "openssl.ssl.context"
local openssl_pkey = require "openssl.pkey"
local ctx = openssl_ctx.new("TLS", false)
ctx:setEphemeralKey(openssl_pkey.new{ type = "EC", curve = "prime256v1" }) Is enough to segfault. |
Tracked in wahern/luaossl#172 |
I tried your code, really this is enough: local openssl_ctx = require "openssl.ssl.context" Maybe in lua_open_xx ? |
In that case you might be having a different issue. Could you share how you install lua-http's dependencies? And your OS/distro? |
@otgo ? |
I tried again and it works XD i dont know why... sorry, i was busy at work these months |
How do I do this in lua-http?
The text was updated successfully, but these errors were encountered: