Improved URI detection code in HTTP env.