basic authentication of KHTMLPart

Andy Brice andyb1 at btclick.com
Tue Dec 23 14:11:12 GMT 2003


I have successfully embedded KHTMLPart in my Qt Application. But I am unable
to send basic authentication through KHTMLPart. Consequently my user has to
log on a second time in a KHTMLPart dialog. I've looked through various
archives and surfed the web and I can't find anything useful.

Does KHTMLPart allow basic authentication?

If so, what is wrong with this code:

    m_extension = m_khtml->browserExtension();
    QString nameAndPassword = QString( "%1:%2" ).arg( username ).arg(
password );
    char encodedNameAndPassword[512];
    Utility::convertToBase64( nameAndPassword.latin1(),
nameAndPassword.length(), encodedNameAndPassword );
     KParts::URLArgs args;
    args.metaData().insert( QString( "Authorization: Basic
%1\r\n%2" ).arg( encodedNameAndPassword ), QString( "OF_Explorer" ) );
    m_extension->setURLArgs( args );

I use something very similar for IE on Win32 and it works fine.

I am developing on SuSe 9.0.

Thanks in advance.

Andy






More information about the kfm-devel mailing list