LJ Archive

Listing 4. Reading the Response

while(1){
  r=SSL_read(ssl,buf,BUFSIZZ);
  switch(SSL_get_error(ssl,r)){
    case SSL_ERROR_NONE:
      len=r;
      break;
    case SSL_ERROR_ZERO_RETURN:
      goto shutdown;
    case SSL_ERROR_SYSCALL:
      fprintf(stderr,
       "SSL Error: Premature close\n");
      goto done;
    default:
      berr_exit("SSL read problem");
  }
  fwrite(buf,1,len,stdout);
}
LJ Archive