cbio = BIO_new_connect("localhost:http");
out = BIO_new_fp(stdout, BIO_NOCLOSE);
- if(BIO_do_connect(cbio) <= 0) {
- fprintf(stderr, "Error connecting to server\n");
- ERR_print_errors_fp(stderr);
- /* whatever ... */
- }
+ if (BIO_do_connect(cbio) <= 0) {
+ fprintf(stderr, "Error connecting to server\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
+ }
BIO_puts(cbio, "GET / HTTP/1.0\n\n");
- for(;;) {
- len = BIO_read(cbio, tmpbuf, 1024);
- if(len <= 0) break;
- BIO_write(out, tmpbuf, len);
+ for ( ; ; ) {
+ len = BIO_read(cbio, tmpbuf, 1024);
+ if(len <= 0)
+ break;
+ BIO_write(out, tmpbuf, len);
}
BIO_free(cbio);
BIO_free(out);
L<BIO_ADDR(3)>
-=cut
-
=head1 COPYRIGHT
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.