improved the matching function for HTML requests