Returns the default port for a given URL scheme.
| 217 | |
| 218 | // Returns the default port for a given URL scheme. |
| 219 | static Option<uint16_t> defaultPort(const string& scheme) |
| 220 | { |
| 221 | // TODO(tnachen): Make default port a lookup table. |
| 222 | if (scheme == "http") { |
| 223 | return 80; |
| 224 | } else if (scheme == "https") { |
| 225 | return 443; |
| 226 | } |
| 227 | |
| 228 | return None(); |
| 229 | } |
| 230 | |
| 231 | |
| 232 | Try<URL> URL::parse(const string& urlString) |