Fossil

Check-in [c13b6ba7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use retry logic for SSL read/write as described in the OpenSSL docs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sslRetry
Files: files | file ages | folders
SHA1: c13b6ba7271841a572b900b28d469a517a6cbbc8
User & Date: mistachkin 2016-04-02 04:47:40.375
Context
2016-04-19
17:44
Use retry logic for SSL read/write as described in the OpenSSL docs. ... (check-in: 4abf6079 user: mistachkin tags: trunk)
2016-04-02
04:47
Use retry logic for SSL read/write as described in the OpenSSL docs. ... (Closed-Leaf check-in: c13b6ba7 user: mistachkin tags: sslRetry)
03:47
Coding style tweaks for the new 'test-all-help' command. ... (check-in: 651f7084 user: mistachkin tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/http_ssl.c.
450
451
452
453
454
455
456
457
458
459
460
461





462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477





478
479
480
481
482
483
484
  return cert;
}

/*
** Send content out over the SSL connection.
*/
size_t ssl_send(void *NotUsed, void *pContent, size_t N){
  size_t sent;
  size_t total = 0;
  while( N>0 ){
    sent = BIO_write(iBio, pContent, N);
    if( sent<=0 ) break;





    total += sent;
    N -= sent;
    pContent = (void*)&((char*)pContent)[sent];
  }
  return total;
}

/*
** Receive content back from the SSL connection.
*/
size_t ssl_receive(void *NotUsed, void *pContent, size_t N){
  size_t got;
  size_t total = 0;
  while( N>0 ){
    got = BIO_read(iBio, pContent, N);
    if( got<=0 ) break;





    total += got;
    N -= got;
    pContent = (void*)&((char*)pContent)[got];
  }
  return total;
}








<


|
|
>
>
>
>
>











<


|
|
>
>
>
>
>







450
451
452
453
454
455
456

457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476

477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
  return cert;
}

/*
** Send content out over the SSL connection.
*/
size_t ssl_send(void *NotUsed, void *pContent, size_t N){

  size_t total = 0;
  while( N>0 ){
    int sent = BIO_write(iBio, pContent, N);
    if( sent<=0 ){
      if( BIO_should_retry(iBio) ){
        continue;
      }
      break;
    }
    total += sent;
    N -= sent;
    pContent = (void*)&((char*)pContent)[sent];
  }
  return total;
}

/*
** Receive content back from the SSL connection.
*/
size_t ssl_receive(void *NotUsed, void *pContent, size_t N){

  size_t total = 0;
  while( N>0 ){
    int got = BIO_read(iBio, pContent, N);
    if( got<=0 ){
      if( BIO_should_retry(iBio) ){
        continue;
      }
      break;
    }
    total += got;
    N -= got;
    pContent = (void*)&((char*)pContent)[got];
  }
  return total;
}