Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3667484
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:00:24+00:00 2026-05-19T02:00:24+00:00

So what I want is simple -I love openSSL api. I found some simple

  • 0

So what I want is simple -I love openSSL api. I found some simple code to begin with for learning it. I am quite new to server creation stuff. I wonder – how to make OpenSSL work with simple http instead of https? I mean I want to provide same service, be capable to jump into https when I need to but have no protection http vercion of it.

I mean It is so grate just to say

 SSLServer server("cert", "pkey", 1420);

  // Set the thread function.
  server.SetPthread_F(conn_thread);

I wish I could do same for not protected http service creation.

After some grate answers I understood I shall edit main question:

How to keep/use only non-blocking TCP server part of OpenSSL library? Main goal would be a crossplatform small and simple in use TCP server on top of which it would be eazy to implement http and http costumized analogs

So If we look onto example:

#include <openssl/ssl.h>
#include <openssl/err.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "sslserver.h"

#define REPLY "<html><body>Metalshell.com OpenSSL Server</body></html>"
#define MAX_PACKET_SIZE 1024

// Called when a new connection is made.
void *conn_thread(void *ssl) {
  int fd = SSL_get_fd((SSL *)ssl);

  if(SSL_accept((SSL *)ssl) == -1) {
    ERR_print_errors_fp(stderr);
  } else {
    char cipdesc[128];
    SSL_CIPHER *sslciph = SSL_get_current_cipher((SSL *)ssl);

    cout << "Encryption Description:\n";
    cout << SSL_CIPHER_description(sslciph, cipdesc, sizeof(cipdesc)) << endl;

    char buff[MAX_PACKET_SIZE];
    // Wait for data to be sent.
    int bytes = SSL_read((SSL *)ssl, buff, sizeof(buff));
    buff[bytes] = '\0';

    // Show the browser request.
    cout << "Recieved: \n" << buff << endl;

    // Send the html reply.
    SSL_write((SSL *)ssl, REPLY, strlen(REPLY));
  }

  // Tell the client we are closing the connection.
  SSL_shutdown((SSL *)ssl);

  // We do not wait for a reply, just clear everything.
  SSL_free((SSL *)ssl);
  close(fd);

  cout << "Connection Closed\n";
  cout << "---------------------------------------------\n";

  pthread_exit(NULL);
}

int main() {
  SSLServer server("cert", "pkey", 1420);

  // Set the thread function.
  server.SetPthread_F(conn_thread);

  while(1) {
    /* Wait for 10 seconds, and if no one trys
     * to connect return back.  This allows us to do
     * other things while waiting.
     */
    server.CheckClients(10);
  }

  return 0;
}

What shall be changed to our server accept all connections not only ssl ones (cout full request if possible) and send them REPLYs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:00:25+00:00Added an answer on May 19, 2026 at 2:00 am

    HTTPS is simple HTTP with SSL (the implementations of which is the point of OpenSSL). The S in HTTPS stands for secure.

    Don’t use the OpenSSL API when you don’t want SSL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a simple effect of slide up and down. I'm new to jquery
I only want a simple Splash Screen Example. Get the Code, Insert my picture,
I've got some simple survey data that I'd love to have a hand with.
I love Go, especially the goroutines. They are simple and efficient. After some digging,
I have a huge table and I want simple sorting. It could be so
I want a simple TextView to behave the way simple_list_item_1 in a ListView does.
I want a simple form with one text box and a submit button. For
I want a simple sign in app in which a user logins successfully if
I want a simple C method to be able to run hex bytecode on
I want launch simple php daemon on Ubuntu without fork. source f.php: #!/usr/bin/php <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.