request_len=strlen(REQUEST_TEMPLATE)+ strlen(host)+6; if(!(request=(char *)malloc(request_len))) err_exit("Couldn't allocate request"); sprintf(request,REQUEST_TEMPLATE, host,port); /* Find the exact request_len */ request_len=strlen(request); r=SSL_write(ssl,request,request_len); switch(SSL_get_error(ssl,r)){ case SSL_ERROR_NONE: if(request_len!=r) err_exit("Incomplete write!"); break; default: berr_exit("SSL write problem"); }