Murga-Projects Forums
luasocket help - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: luasocket help (/showthread.php?tid=283)


luasocket help - asafp - 02-14-2008 02:06 PM

I'm trying to do a HTTP POST and can't figure out how to send the postdata.

Doc http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/http.html
states "source: simple LTN12 source to provide the request body. If there is a body, you need to provide an appropriate "content-length" request header field, or the function will attempt to send the body as "chunked" (something few servers support). Defaults to the empty source;"

I just want to send a simple string, something like ltn12.source.xxxx(postdata), but can't figure out what xxxx should be.

Any direction would be greatly appreciated.


RE: luasocket help - Juergen - 02-14-2008 07:58 PM

asafp Wrote:
I just want to send a simple string, something like ltn12.source.xxxx(postdata), but can't figure out what xxxx should be.

Any direction would be greatly appreciated.


Have you tried ltn12.source.string(postdata) ? ;-)

Juergen


RE: luasocket help - asafp - 02-15-2008 03:13 AM

ltn12.source.string(postdata) syntax did seem to work.
thanx.

However, in order to get the results I want, I need to be able to handle cookies. Doesn't seem to be much doc or examples out there.

Would appreciate it if anyone has cookie example.


RE: luasocket help - asafp - 02-18-2008 04:55 AM

I have built a rudimentary cookie parser intended for use in client side HTTP applications using luasocket. It has met my needs for some simple applications. It lacks handling of expires, domain, and path options and the parsing of Set-Cookie may not handle all syntax variations.


RE: luasocket help - asafp - 06-30-2008 04:58 AM

Does murgaLua contain the latest version of luasocket? Is there a way I can tell?
According to this link, luasocket 2.0 (beta 3) fixes a bug where "http.PROXY wasn't working" and this is the problem I'm having.
http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/old/luasocket-2.0-beta3/

The documentation on luasocket is still lacking. The problem I'm having may be something I'm not doing quite right.

I added the following line just to test a proxy via privoxy.
http.PROXY='http://127.0.0.1:8118'


RE: luasocket help - asafp - 06-30-2008 09:57 AM

Problem seems to be in Privoxy or luasocket and not murgaLua. Some sites seem to work ok and others don't.