lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


of course!  That modified the header, but alas it didn't solve my problem :(

On Tue, Jul 6, 2010 at 6:38 PM, Valerio Schiavoni
<valerio.schiavoni@gmail.com> wrote:
> hi,
>
> try adding:
>
> ["Connection"]="Keep-Alive"
>
> to the headers sent in the request.
>
> On Tue, Jul 6, 2010 at 5:56 PM, Wesley Smith <wesley.hoke@gmail.com> wrote:
>> I'm trying to do some XML-RPC stuff and am having some serious
>> problems with consistency.  It seems that about 1 of 5 tries works,
>> the rest timeout using the following code:
>>
>> local response = {}
>>        http.request{
>>                url = url,
>>                method = "POST",
>>                headers = {
>>                        ["content-length"] = body:len(),
>>                        ["content-type"] = "text/xml",
>>                        ["user-agent"] = "Lua XMLRPC/0.0",
>>                        ["cache-control"] = "no-cache",
>>                        ["pragma"] = "no-cache",
>>                },
>>                source = ltn12.source.string(body),
>>                sink = ltn12.sink.table(response)
>>        }
>>        for k, v in pairs(response) do
>>                print("response: ", k, v)
>>        end
>>
>>
>> The web server and everything is all on my local machine, so there
>> shouldn't be a latency problem.  I'm sniffing the packets and
>> comparing them to an example built in JAVA that works flawlessly.
>> What I notice is that when the POST data happens to be split across
>> packets with different times (even 1 millisecond difference), it
>> fails.  This happens in the working software as well with one caveat:
>>
>> In LuaSocket, the HTTP header ends with "connection: close" whereas
>> the flawless software ends with connect: keep-alive (uses persistent
>> connections).  Is there a way to do this in LuaSocket?  I'm not seeing
>> anything in the docs.
>>
>> This is just a hunch since I'm not a networking expert by any means.
>> So if my logic about what is going wrong seems off, I'd like to know
>> as well.
>>
>> thanks!
>> wes
>>
>