main/ucb/source/ucp/webdav/SerfSession.cxx
// -------------------------------------------------------------------
// helper function
// it composes the uri for lockstore registration
helper function
it composes the uri for lockstore registration
helper function it composes the uri for lockstore registration
rtl::OUString SerfSession::composeCurrentUri(const rtl::OUString & inPath)
{
    rtl::OUString aScheme( m_aUri.GetScheme() );
    rtl::OUStringBuffer aBuf( aScheme );
    aBuf.appendAscii( "://" );
    if ( m_aUri.GetUserInfo().getLength() > 0 )
    {
        aBuf.append( m_aUri.GetUserInfo() );
        aBuf.appendAscii( "@" );
    }
    if ( ( m_aUri.GetHost().indexOf( ':' ) != -1 ) &&
         ( m_aUri.GetHost()[ 0 ] != sal_Unicode( '[' ) ) )
    {
        aBuf.appendAscii( "[" );
        aBuf.append( m_aUri.GetHost() );
        aBuf.appendAscii( "]" );
    }
    else
    {
        aBuf.append( m_aUri.GetHost() );
    }
    bool bAppendPort = true;
    sal_Int32 aPort = m_aUri.GetPort();
    switch ( aPort )
    {
    case DEFAULT_HTTP_PORT:
        bAppendPort = aScheme.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "http" ) );
        break;
    case DEFAULT_HTTPS_PORT:
        bAppendPort = !aScheme.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "https" ) );
        break;
    }
    if ( bAppendPort )
    {
        aBuf.appendAscii( ":" );
        aBuf.append( rtl::OUString::valueOf( aPort ) );
    }
    aBuf.append( inPath );
    rtl::OUString   aUri(aBuf.makeStringAndClear() );
    return aUri;
}
rtl :: OUString SerfSession :: composeCurrentUri ( const rtl :: OUString & inPath ) { rtl :: OUString aScheme ( m_aUri . GetScheme ( ) ) ; rtl :: OUStringBuffer aBuf ( aScheme ) ; aBuf . appendAscii ( " " ) ; if ( m_aUri . GetUserInfo ( ) . getLength ( ) > 0 ) { aBuf . append ( m_aUri . GetUserInfo ( ) ) ; aBuf . appendAscii ( " " ) ; } if ( ( m_aUri . GetHost ( ) . indexOf ( ' ' ) != -1 ) && ( m_aUri . GetHost ( ) [ 0 ] != sal_Unicode ( ' ' ) ) ) { aBuf . appendAscii ( " " ) ; aBuf . append ( m_aUri . GetHost ( ) ) ; aBuf . appendAscii ( " " ) ; } else { aBuf . append ( m_aUri . GetHost ( ) ) ; } bool bAppendPort = true ; sal_Int32 aPort = m_aUri . GetPort ( ) ; switch ( aPort ) { case DEFAULT_HTTP_PORT : bAppendPort = aScheme . equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( " " ) ) ; break ; case DEFAULT_HTTPS_PORT : bAppendPort = ! aScheme . equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( " " ) ) ; break ; } if ( bAppendPort ) { aBuf . appendAscii ( " " ) ; aBuf . append ( rtl :: OUString :: valueOf ( aPort ) ) ; } aBuf . append ( inPath ) ; rtl :: OUString aUri ( aBuf . makeStringAndClear ( ) ) ; return aUri ; }
helper function
it composes the uri for lockstore registration
helper function it composes the uri for lockstore registration
// Is host a numeric IPv6 address? // append port, but only, if not default port.