Hi
I am trying to make  simple https Access client.
I refer to "demos/bio/sconnect.c". that is very helpful and useful.
I already succeeded to run sconnect.c inspite of needing little change.
But I am now against my ignorantness about  OpenSSL.
In  "sconnect.c", client only get 1page of  sever.
as following seaquence:

 1.  RAND_seed(rnd_seed, sizeof rnd_seed); 
 2.  SSL_load_error_strings();
 3.  SLeay_add_ssl_algorithms();
 4.  ssl_ctx=SSL_CTX_new(SSLv23_client_method());

 5.  ssl=SSL_new(ssl_ctx);
 6.  SSL_set_connect_state(ssl);
 7.  ssl_bio=BIO_new(BIO_f_ssl());
 8.  BIO_set_ssl(ssl_bio,ssl,BIO_CLOSE);
 9.  out=BIO_new(BIO_s_connect());
10.  BIO_set_conn_hostname(out,host);
11.  BIO_set_nbio(out,1);
12. out=BIO_push(ssl_bio,out);
13. BIO_write(out,&(p[off]),len);
14. i=BIO_read(out,buf,sizeof(buf));

15. BIO_free_all(out);
16. SSL_CTX_free(ssl_ctx);

But,
I want to navigate client ,
   like  "https://server/index.html"  -> mypage.html -> mypage2.html.

I understand  at least  (step 1.- 4.) is ONCE for the whole application.  
then , I wrote as following,

 1.  RAND_seed(rnd_seed, sizeof rnd_seed); 
 2.  SSL_load_error_strings();
 3.  SLeay_add_ssl_algorithms();
 4.  ssl_ctx=SSL_CTX_new(SSLv23_client_method());
for(;;)
{
 5.  ssl=SSL_new(ssl_ctx);
 6.  SSL_set_connect_state(ssl);
 7.  ssl_bio=BIO_new(BIO_f_ssl());
 8.  BIO_set_ssl(ssl_bio,ssl,BIO_CLOSE);
 9.  out=BIO_new(BIO_s_connect());
10.  BIO_set_conn_hostname(out,host);
11.  BIO_set_nbio(out,1);
12. out=BIO_push(ssl_bio,out);
13. BIO_write(out,&(p[off]),len);
14. i=BIO_read(out,buf,sizeof(buf));
*14-2   SSL_shutdown(ssl);
}
15. BIO_free_all(out);
16. SSL_CTX_free(ssl_ctx);

in this sequence,porogram seems to run good.

but,at this time I check,network moniter,I find out in "for(;;)",
ssl handshake is done each loop.
I don't intend this result.
I think , probrem is in (step 5-12).
but I don't know how to do.
The various sample in this mail arcive is written more raw level
coding about BIO.
I feel should study  BIO. but at this time,I want to write simple coding
like "sconnect.c".

/******************************** 
   Shuhei Nagasue
   Compaq Computer KK

  TEL:03-5495-8664 FAX:03-5463-8622
  E-Mail [EMAIL PROTECTED]
*********************************/

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to