Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision c4b969639a4ace587f67b7cda86f8fbdcb0e79ce authored by Matt Caswell on 19 December 2014, 10:55:54 UTC, committed by Matt Caswell on 19 December 2014, 14:11:20 UTC
Fix a problem if CFLAGS is too long cversion.c fails to compile when config
is run with --strict-warnings.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 488f16e31b8f5ec2513410929325d0830d76762d)
1 parent bfb2e4b
  • Files
  • Changes
  • 5c26d2a
  • /
  • demos
  • /
  • bio
  • /
  • sconnect.c
Raw File
Cook and download a directory from the Software Heritage Vault

You have requested the cooking of the directory with identifier None into a standard tar.gz archive.

Are you sure you want to continue ?

Download a directory from the Software Heritage Vault

You have requested the download of the directory with identifier None as a standard tar.gz archive.

Are you sure you want to continue ?

Cook and download a revision from the Software Heritage Vault

You have requested the cooking of the history heading to revision with identifier swh:1:rev:c4b969639a4ace587f67b7cda86f8fbdcb0e79ce into a bare git archive.

Are you sure you want to continue ?

Download a revision from the Software Heritage Vault

You have requested the download of the history heading to revision with identifier swh:1:rev:c4b969639a4ace587f67b7cda86f8fbdcb0e79ce as a bare git archive.

Are you sure you want to continue ?

Invalid Email !

The provided email is not well-formed.

Download link has expired

The requested archive is no longer available for download from the Software Heritage Vault.

Do you want to cook it again ?

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • content
revision badge
swh:1:rev:c4b969639a4ace587f67b7cda86f8fbdcb0e79ce
content badge Iframe embedding
swh:1:cnt:880344eb78453b80b3c87a5c357b2b1114a82d77
sconnect.c
/* NOCW */
/* demos/bio/sconnect.c */

/* A minimal program to do SSL to a passed host and port.
 * It is actually using non-blocking IO but in a very simple manner
 * sconnect host:port - it does a 'GET / HTTP/1.0'
 *
 * cc -I../../include sconnect.c -L../.. -lssl -lcrypto
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <openssl/err.h>
#include <openssl/ssl.h>

extern int errno;

int main(argc,argv)
int argc;
char *argv[];
	{
	char *host;
	BIO *out;
	char buf[1024*10],*p;
	SSL_CTX *ssl_ctx=NULL;
	SSL *ssl;
	BIO *ssl_bio;
	int i,len,off,ret=1;

	if (argc <= 1)
		host="localhost:4433";
	else
		host=argv[1];

#ifdef WATT32
	dbug_init();
	sock_init();
#endif

	/* Lets get nice error messages */
	SSL_load_error_strings();

	/* Setup all the global SSL stuff */
	OpenSSL_add_ssl_algorithms();
	ssl_ctx=SSL_CTX_new(SSLv23_client_method());

	/* Lets make a SSL structure */
	ssl=SSL_new(ssl_ctx);
	SSL_set_connect_state(ssl);

	/* Use it inside an SSL BIO */
	ssl_bio=BIO_new(BIO_f_ssl());
	BIO_set_ssl(ssl_bio,ssl,BIO_CLOSE);

	/* Lets use a connect BIO under the SSL BIO */
	out=BIO_new(BIO_s_connect());
	BIO_set_conn_hostname(out,host);
	BIO_set_nbio(out,1);
	out=BIO_push(ssl_bio,out);

	p="GET / HTTP/1.0\r\n\r\n";
	len=strlen(p);

	off=0;
	for (;;)
		{
		i=BIO_write(out,&(p[off]),len);
		if (i <= 0)
			{
			if (BIO_should_retry(out))
				{
				fprintf(stderr,"write DELAY\n");
				sleep(1);
				continue;
				}
			else
				{
				goto err;
				}
			}
		off+=i;
		len-=i;
		if (len <= 0) break;
		}

	for (;;)
		{
		i=BIO_read(out,buf,sizeof(buf));
		if (i == 0) break;
		if (i < 0)
			{
			if (BIO_should_retry(out))
				{
				fprintf(stderr,"read DELAY\n");
				sleep(1);
				continue;
				}
			goto err;
			}
		fwrite(buf,1,i,stdout);
		}

	ret=1;

	if (0)
		{
err:
		if (ERR_peek_error() == 0) /* system call error */
			{
			fprintf(stderr,"errno=%d ",errno);
			perror("error");
			}
		else
			ERR_print_errors_fp(stderr);
		}
	BIO_free_all(out);
	if (ssl_ctx != NULL) SSL_CTX_free(ssl_ctx);
	exit(!ret);
	return(ret);
	}

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top