-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken parsing of HTTP headers #39
Comments
Thank you very much! |
I think the problem in https://github.com/abique/mimosa/blob/42c0041b570b55a24c606a7da79c70c9933c07d4/mimosa/http/request-parser.y#L98
|
KEY_ACCEPT_ENCODING shows up first in the lexer, but does not hurt to move it down. |
I've added a unit test with your example, and updated mimosa. |
The new commit of mimosa submodule is non existent. Did you forget to push something on the mimosa repository? |
Super strange I get timeout to push and pull to mimosa... |
You can try again now. |
hefur now crashes immediately when I try to load https://tracker.domain.com/stat, with the same error:
|
I've pushed some changes, that assertion wasn't correct. |
It's better. The client's public address is correctly registered in hefur, but the response sent by hefur to Transmission is still bogus, with nonsensical values. File sharing with other peers works though. |
Yeah something must have gone wrong, because it is a strange error to have a inet addr that isn't ipv4 or ipv6. |
It may be because hefur and Transmission are on the same host? |
Still it should be using ipv4/6 |
The parsing of HTTP headers is broken for certain value of
Accept-Encoding
when Hefur is behind a reverse proxy.Apache config:
Hefur is launched like this:
$ hefurd -torrent-dir /srv/tracker -bind-addr 127.0.0.1 -reverse-proxy-from 127.0.0.1 -reverse-proxy-header X-Forwarded-For
The problem arise here:
hefur/hefur/log-handler.cc
Lines 24 to 25 in 5136250
With qBittorrent, Apache sends the following request to Hefur:
request.unparsedHeaders()
returns all headers andX-Forwarded-For
is found.With Transmission, Apache sends the following request to Hefur:
request.unparsedHeaders()
returns onlyAccept: */*
If I remove
Accept-Encoding
from the request sent by Apache (withRequestHeader unset Accept-Encoding
in<Location />
), then the request is parsed correctly and the real IP is found, but Hefur crash soon after with:hefurd[28911]: hefurd: hefur/address.cc:133: hefur::Address& hefur::Address::operator=(const sockaddr*): Assertion 'false' failed.
So an announce request from Transmission seems totally broken: the real IP is not found, the response is bad (wrong values of seeders/leechers) and Transmission try to announce again every 8 seconds in a loop.
Everything is working fine with qBittorrent.
OS: Arch Linux
Hefur: 1.0
Apache: 2.4.51
qBittorrent: 4.3.9
Transmission: 3.00
The text was updated successfully, but these errors were encountered: