EvandroLG/pegasus.lua

Response:write crashes on Windows

hoensr opened this issue · 4 comments

Hi, when I write response:write('hello pegasus world!') like in the demo example, lua.exe crashes on me.
It seems like the os.date in line
self:addHeader('Date', os.date('!%a, %d %b %Y %T GMT', os.time()))
in response.lua doesn't work in Windows?

It's the "%T" which crashes.
In Lua, %T is not officially supported.
I have tried it in C, and strftime crashes nastily with "%T".
I have found one link about this -- sorry, not in English; basically it says that Lua should not crash upon %T. I don't know how to handle this, though.

PS: I have found almost the same bug on the Lua mailing list. I think it would be better to live without the %T and have it work platform-independently.
PPS: Another interesting mailing list post.

Hi @hoensr
I think in our latest updates we haven't tested on Windows =/
I'll try fix it soon. Thank you ;)

You're welcome! For me, I have simply removed the "addHeader" because I don't need it. :-)
BTW, thank you for the great project!

Removing addHeader didn't do it for me. Changing the %T to %X in line 168 of response.lua fixes the problem. I'm not set up for Git on my current machine but I'll try to remember to fix and submit a pull request later.