[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaSocket problem
- From: LW <lopticon@...>
- Date: Fri, 17 Jul 2009 10:32:39 -0400
I recently downloaded LuaSocket and started a small project to help me learn lua.
So I took an old perl project I did a few years back and started porting it and adding
features.
For the network (web) piece I ran into a problem connecting to an IIS web server.
On execution I get an error from the remote server about the request verb bad.
A couple of things to note:
After a bit of googling I found one post on a forum that
suggested some versions of IIS are picky about headers
so this lead me to change header casing in the adjustheaders function.
It was also suggested to add a simple function to adjust the header casing
from lower to capitalize.. Just above the adjustheaders I added a function for this
and I'm still getting the, "request verb being bad".
Below is the code in question:
Does anyone see anything out of the obvious?
#!/usr/loca/bin/lua
local http = require("socket.http")
local io = require("io")
local ltn12 = require("ltn12")
UserID = "userID=XXXXX"
APIKey = "apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
CharID = "characterID=XXXXXXX"
--Lame I know...
reqbody = UserID.."&"..APIKey.."&"..CharID
http.request {
method = "POST",
url = "" href="http://api.eve-online.com/char/CharacterSheet.xml.aspx">http://api.eve-online.com/char/CharacterSheet.xml.aspx",
headers= {
["Content-Type"] = "application/x-www-form-urlencoded",
["Content-Length"] = string.len(reqbody),
},
source = ltn12.source.string(reqbody),
sink = ltn12.sink.file(io.stdout)
}
Thanks,
-LW