storage_uri::storage_uri(const web::http::uri& primary_uri, const web::http::uri& secondary_uri)
    : m_primary_uri(primary_uri), m_secondary_uri(secondary_uri)
{
    if (primary_uri.is_empty())
    {
        throw std::invalid_argument("primary_uri");
    }

    if (!secondary_uri.is_empty() &&
            (primary_uri.resource() != secondary_uri.resource()))
    {
        throw std::invalid_argument(utility::conversions::to_utf8string(protocol::error_storage_uri_mismatch));
    }
}