开发者

LuaSockets POST data issue [LUA]

开发者 https://www.devze.com 2023-03-22 21:49 出处:网络
I\'m getting GET data without issue using: local get, err = client:receive() 开发者_JS百科 But I\'m not sure how to receive POST data.

I'm getting GET data without issue using:

      local get, err = client:receive()
开发者_JS百科

But I'm not sure how to receive POST data. I've tried:

      local get, err = client:receive('*a')

But the server seems to always timeout on POST data (the test data is just an textbox with some words in it)

Any help fully appreciated and as always please link me if this is a repeat question!

Cheers!


I've managed to find a solution to my problem, seems that the:

local get, err = client:receive('*a')

method only returns complete data. Headers seem to fall under partially received rather than fully received and as such gets placed to a third variable:

local data, emsg, partial = client:receive(pattern, prefix)

This seems to be undocumented, but I may just have missed it

0

精彩评论

暂无评论...
验证码 换一张
取 消