Implement $protocol parameter in Config base_url() and site_url() methods

Let's keep the implementation logic in one place.
Improves 2023c3d05b042cf1322286d69557c2b8bf3bd8d5.