torhve / weechat-matrix-protocol-script

A WeeChat script in Lua that implements the matrix.org chat protocol
349 stars 52 forks source link

Invalid http request: HTTP/2 200 #128

Closed tulkki closed 5 years ago

tulkki commented 5 years ago

WeeChat 2.3 (C) 2003-2018

I had weechat-matrix-protocol-script running but for some reason after a reboot I can't login to matrix.org.

How can I fix this ?

lua: unloading script "matrix"
matrix: Unloading
matrix: done cleaning up!
lua: script "matrix" unloaded
lua: loading script "/home/matrix/.weechat/lua/autoload/matrix.lua"
lua: registered script "matrix", version 3 (Matrix.org chat plugin)
matrix: Unable to load olm encryption library. Not enabling encryption. Please see documentation (README.md) for information on how to enable.
matrix: Connecting to homeserver URL: https://matrix.org/
Invalid http request: HTTP/2 200
date: Sun, 11 Nov 2018 15:42:36 GMT
content-type: application/json
set-cookie: __cfduid=d179de8cb18eebfaca21ad12b1b8878011541950954; expires=Mon, 11-Nov-19 15:42:34 GMT; path=/; domain=.matrix.org; HttpOnly
cache-control: no-cache, no-store, must-revalidate
access-control-allow-origin: *
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 4781de9b6aed4bf3-GRU

{"user_id": " .... }

I read #113, #39 issues but I don't have a password error .

tulkki commented 5 years ago

If I reload matrix script sometimes I have this output too: /script reload matrix

Call to API errored in command url:https://matrix.org/_matrix/client/r0/login, maybe timeout?
astrakk commented 5 years ago

Same story here.

    │ matrix: Connecting to homeserver URL: https://matrix.org/
    │ lua scripts loaded: matrix
=!= │ Invalid http request: HTTP/2 200
    │ date: Wed, 14 Nov 2018 04:50:09 GMT
    │ content-type: application/json
    │ set-cookie: __cfduid=de78706c564f1db36ab648a5b40f257471542171007; expires=Thu, 14-Nov-19 04:50:07 GMT; path=/; domain=.matrix.org; HttpOnly
    │ cache-control: no-cache, no-store, must-revalidate
    │ access-control-allow-origin: *
    │ access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
    │ access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
    │ expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    │ server: cloudflare
    │ cf-ray: 4796dafcfbfc65db-SYD
astrakk commented 5 years ago

After some experimentation I've found the offending line.

I changed line 474 of matrix.lua from: local httpversion, status_code, reason_phrase = line:match("^HTTP/(1%.[01]) (%d%d%d) (.-)\r?\n")

to: local httpversion, status_code, reason_phrase = line:match("^HTTP/([012]) (%d%d%d) (.-)\r?\n")

This seemingly resolved the issue for me but I'm unsure if this is the correct way to go about this sort of thing.