RE: wwwlib and SSL

Thanks a lot Vic. How can I get www-lib? Is there a free download for that
somewhere or we need to buy it?

Appreciate your assistance.

Kaustubh

-----Original Message-----
From: Vic Bancroft [mailto:bancroft@america.net]
Sent: Thursday, April 24, 2003 6:17 PM
To: Kaustubh Deshmukh
Cc: www-lib@w3.org
Subject: Re: wwwlib and SSL



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

Received on Thursday, 24 April 2003 12:10:02 UTC