News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
luasocket help
Author Message
asafp
Member
***


Posts: 81
Group: Registered
Joined: Jan 2008
Status: Offline
Reputation: 0
Post: #1
luasocket help

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/pro.../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.

02-14-2008 02:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Juergen
Member
***


Posts: 81
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #2
RE: luasocket help

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

02-14-2008 07:58 PM
Find all posts by this user Quote this message in a reply
asafp
Member
***


Posts: 81
Group: Registered
Joined: Jan 2008
Status: Offline
Reputation: 0
Post: #3
RE: luasocket help

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.

02-15-2008 03:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
asafp
Member
***


Posts: 81
Group: Registered
Joined: Jan 2008
Status: Offline
Reputation: 0
Post: #4
RE: luasocket help

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.



Attached File(s)
.lua File  CookEase.lua (Size: 2.26 KB / Downloads: 8)
02-18-2008 04:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
asafp
Member
***


Posts: 81
Group: Registered
Joined: Jan 2008
Status: Offline
Reputation: 0
Post: #5
RE: luasocket help

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/pro...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'

06-30-2008 04:58 AM
Visit this user's website Find all posts by this user Quote this message in a reply
asafp
Member
***


Posts: 81
Group: Registered
Joined: Jan 2008
Status: Offline
Reputation: 0
Post: #6
RE: luasocket help

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

06-30-2008 09:57 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: