Commit Graph

3 Commits

Author SHA1 Message Date
Adrian Perez de Castro
51c8eda815 Fix conversion of http.headers in Lua 5.1 and LuaJIT
The __pairs metamethod was introduced in 5.2, so instead of using pairs()
on http.headers values, use its :each() method — which is what the __pairs
metamethod calls anyway.
2016-07-04 18:23:35 +03:00
Adrian Perez de Castro
0aa232965c Workaround LuaSocket's lax response validation
When receiving a HTTP response without a statusline, "nil" is returned as
reponse headers and status line values, but the response code will still
be "200 Success", which is quite not right as there wasn't ever a response
status code received. This patch adds a check for a status line, and returns
with an early error if needed.

This condition can be triggered by trying to speak plain HTTP to a
HTTPS-enabled server, e.g. using http://matrix.org:8448 instead of
https://matrix.org:8448 as homeserver URL.
2016-07-04 17:52:39 +03:00
Adrian Perez de Castro
bd811c859e Rename matrix.factory.* -> matrix.httpclient.*
The old name didn't really make much sense after all...
2016-07-01 05:10:22 +03:00