| 1745 | } |
| 1746 | |
| 1747 | bool ParseHttpServerAddress(butil::EndPoint* point, const char* server_addr_and_port) { |
| 1748 | std::string scheme; |
| 1749 | std::string host; |
| 1750 | int port = -1; |
| 1751 | if (ParseURL(server_addr_and_port, &scheme, &host, &port) != 0) { |
| 1752 | LOG(ERROR) << "Invalid address=`" << server_addr_and_port << '\''; |
| 1753 | return false; |
| 1754 | } |
| 1755 | if (scheme.empty() || scheme == "http") { |
| 1756 | if (port < 0) { |
| 1757 | port = 80; |
| 1758 | } |
| 1759 | } else if (scheme == "https") { |
| 1760 | if (port < 0) { |
| 1761 | port = 443; |
| 1762 | } |
| 1763 | } else { |
| 1764 | LOG(ERROR) << "Invalid scheme=`" << scheme << '\''; |
| 1765 | return false; |
| 1766 | } |
| 1767 | if (str2endpoint(host.c_str(), port, point) != 0 && |
| 1768 | hostname2endpoint(host.c_str(), port, point) != 0) { |
| 1769 | LOG(ERROR) << "Invalid host=" << host << " port=" << port; |
| 1770 | return false; |
| 1771 | } |
| 1772 | return true; |
| 1773 | } |
| 1774 | |
| 1775 | const std::string& GetHttpMethodName( |
| 1776 | const google::protobuf::MethodDescriptor*, |