Open qmm0523 opened 6 years ago
Hi, thank you for submitting the PR. Sorry for the delay on my side. IMHO we would better follow the same request parameter as "official" client. We would keep the gzip header and to detect the response instead. gzip format always starts with 0x1f 0x8b so it can be easy to detect.
Sure, you can use gzip module to deal with these HTTP requests, but change the Accept-Encoding is the fastest way to fix the current problem. I think it's unnecessary that keep every header the same with the official, The web server such as Nginx will deal with encoding and the web application don't care it.
We shouldn't assume the behavior of xunlei, which is a blackbox to us. Though the codec part is more likely to be done in a generic way and xunlei doesn't check it at all. Besides of that, fastdick server has a history of not respecting accept-encoding when we ask for gzip and it sends plaintext response. I think the better choice here in either way is to detect the response on our side.
I noticed that the codes set HTTP header 'Accept-Encoding' to 'gzip', but forgot to write code to decompress gzip HTTP packet, so it cause problem(see https://github.com/fffonion/Xunlei-Fastdick/issues/133).Fixing way is simple,change the 'gzip' to '', then the server will no loger reply you with gzip compressed packets.