| 254 | const std::string url::AMQPS("amqps"); |
| 255 | |
| 256 | uint16_t url::port_int() const { |
| 257 | if (port() == AMQP) return 5672; |
| 258 | if (port() == AMQPS) return 5671; |
| 259 | std::istringstream is(port()); |
| 260 | uint16_t result; |
| 261 | is >> result; |
| 262 | if (is.fail()) |
| 263 | throw url_error("invalid port '" + port() + "'"); |
| 264 | return result; |
| 265 | } |
| 266 | |
| 267 | std::ostream& operator<<(std::ostream& o, const url& u) { |
| 268 | return o << std::string(u); |