0

I'm getting GET data without issue using:

      local get, err = client:receive()

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!

Shane Gadsby
  • 1,260
  • 1
  • 13
  • 19
  • Lua is a word/name, not an acronym, so you don't write it as LUA. Seems to be a pet peeve around here. – BMitch Jul 25 '11 at 11:45
  • Are you developing a web server or client? – BMitch Jul 25 '11 at 11:49
  • @BMitch Oh, sorry thanks for the edit! Also: Web server, I need to receive the POST data from web browsers – Shane Gadsby Jul 25 '11 at 12:11
  • go ahead and answer your own question below and then click the checkmark to mark it as answered. This helps when people are looking for unanswered questions. – BMitch Jul 25 '11 at 17:07
  • I would have done so, but as a new member I was unable to do so until waiting 8 hours; with that time constraint in mind I edited the original post while the solution was still fresh and planned on re-posting it after the time limit expired. Please also note that I cannot make my own post as an answer until 24hrs aftert making said post. – Shane Gadsby Jul 26 '11 at 08:32
  • I think they're trying to get you to stick around and answer a few questions. :) (Well, that and to prevent abuse.) – BMitch Jul 26 '11 at 11:41

1 Answers1

1

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

Shane Gadsby
  • 1,260
  • 1
  • 13
  • 19