pts-core: Improved detection of file downloads that fail and serve HTML 404/not found responses