Moved HTTP-dependent method to where it is used and where it belongs.