Re: wwwlib and SSL

Vic Bancroft <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>

On Wed, 23 Apr 2003, Kaustubh Deshmukh wrote:

> We have a requirement where we need to communicate to a socket server
> through https connection. This needs to be done through a C++ application
> running on Solaris. Will this be possible using www-lib? How?

You should take a look at http://www.w3.org/Library/Examples/wwwssl.c, in 
particular the following fragment,

    /* Set the SSL protocol method. By default, it is the highest
       available protocol. Setting it up to SSL_V23 allows the client
       to negotiate with the server and set up either TSLv1, SSLv3, 
       or SSLv2 */
    HTSSL_protMethod_set (HTSSL_V23);

    /* Set the certificate verification depth to 2 in order to be able to
       validate self signed certificates */
    HTSSL_verifyDepth_set (2);

    /* Register SSL stuff for handling ssl access */
    HTSSLhttps_init(YES);

Since you are using c++, the libwww function prototypes will need to be 
declared as being external c calls.  For example, around your includes,

  #include <iostream.h>

  extern "C" {
  #define BOOL int
  #include <HTChunk.h> 
  }

  void main( int argc, char** argv ) {
    HTChunk * c = HTChunk_new ( 1024 );
    int s = HTChunk_size ( c );
    cout << "Chunk allocated at " << c << ", " 
         << "of size " << s << "." << endl;
  }

We may do this is to add a decoration to the top of the libwww headers
like,

    #ifdef __cplusplus
    extern "C" {
    #endif

and the corresponding 

    #ifdef __cplusplus
    }
    #endif

more,
l8r,
v

-- 
No bugs were harmed in the development of this software. 

http://elvis.dlogic.org/~bancroft/tiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.