mailwatch / MailWatch

MailWatch for MailScanner is a web-based front-end to MailScanner
http://mailwatch.org/
GNU General Public License v2.0
117 stars 66 forks source link

Updating the GeoIP database gives error #1287

Closed dwhile closed 1 year ago

dwhile commented 1 year ago

When updating the GeoIP database from the interface the following is output:

Downloading file, please wait... Error occurred while downloading GeoIP data file: Response could not be parsed Download complete, unpacking files...

GeoIP data file successfully unpacked Process completed!

On investigation it is because the server is using the HTTP2 protocol and in mailscanner/lib/request/Request.php the returned headers are only checked for a 1.{x} response. So an error is generated.

changing line 572 in mailscanner/lib/request/Request.php from: preg_match('#^HTTP/1.\d[ \t]+(\d+)#i', array_shift($headers), $matches); to: preg_match('#^HTTP[/1.\d]|[2][ \t]+(\d+)#i', array_shift($headers), $matches);

Solves this problem and allows the update to work correctly.

endelwar commented 1 year ago

Thank you!