W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2003

Re: wwwlib and SSL

From: Vic Bancroft <bancroft@america.net>
Date: Thu, 24 Apr 2003 08:47:08 -0400 (EDT)
To: Kaustubh Deshmukh <kaustubh.deshmukh@patni.com>
cc: www-lib@w3.org
Message-ID: <Pine.LNX.4.44.0304240809510.9755-100000@pc70.home.maioriello.net>


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 08:47:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:43 GMT