Skip to content

Fix for issue #444 "Unable to compile without OpenSSL" #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 20, 2015
Merged

Fix for issue #444 "Unable to compile without OpenSSL" #541

merged 2 commits into from
Jul 20, 2015

Conversation

celsius
Copy link

@celsius celsius commented Jul 16, 2015

  • add an option CPP-NETLIB_ENABLE_HTTPS to enable/disable HTTPS in cmake config. By default it is turned ON (enable HTTPS) so as to preserve before-patch behavior. Turn it OFF to disable entirely SSL usage and linkage in libraries and header files.
  • when SSL is disabled, the 'stream_handler' struct is replaced by a simple tcp_socket, and function calls in the files option.hpp, async_server.hpp and async_connection.hpp are adapted and compiled accordingly.

Note that sync_...hpp files don't have problems (yet) since SSL is not integrated into these. Also note that a cleaner solution might be to consider implementing two separate struct 'stream_handler' and 'stream_handler_ssl', or something similar (in order to avoid most, if not all, the current #ifdef added by the commit in async_server and async_connection).

The changes to the code are quite simple but, for the record, I compiled this with the new option ON and OFF and successfully tested it for both configurations with a slightly adapted version of the asynchronous http server "hello world" example. I tried to be thorough while searching the code for SSL-related code, but I'm not very familiar with the whole code base, so some parts may have slipped past my attention.

- add an option CPP-NETLIB_ENABLE_HTTPS to enable/disable HTTPS in
  cmake config. By default it is turned ON (enable HTTPS) so as to
  preserve before-patch behavior. Turn it OFF to disable entirely
  SSL usage and linkage in libraries and header files.
- when SSL is disabled, the 'stream_handler' struct is replaced by
  a simple tcp_socket, and function calls in the files option.hpp,
  async_server.hpp and async_connection.hpp are adapted and compiled
  accordingly.

Note that sync_...hpp files don't have problems (yet) since SSL is
not integrated into these. Also note that a cleaner solution might
be to consider implementing two separate struct 'stream_handler' and
'stream_handler_ssl', or something similar.
@deanberris
Copy link
Member

Thanks @celsius -- can you also update the travis config too, so we can make sure this doesn't break in the configurations we care about and test continuously?

@celsius
Copy link
Author

celsius commented Jul 17, 2015

I've never used travis before, am I supposed to add this into the "env:" section of ".travis.yml" ?

I'm asking because it would increase the number of compilation tests by a factor 2 (i.e. each test would be made with with HTTPS ON or OFF). If that's ok with you, then I'll proceed.

@deanberris
Copy link
Member

Yes @celsius -- thanks in advance!

@celsius
Copy link
Author

celsius commented Jul 19, 2015

@deanberris pushed and Travis CI build passed. Always happy to help.

@deanberris
Copy link
Member

LGTM -- thanks @celsius!

deanberris added a commit that referenced this pull request Jul 20, 2015
Fix for issue #444 "Unable to compile without OpenSSL"
@deanberris deanberris merged commit 2bc6afb into cpp-netlib:0.11-devel Jul 20, 2015
@celsius celsius deleted the 0.11-devel-fix-disable-ssl branch July 20, 2015 09:46
@celsius celsius restored the 0.11-devel-fix-disable-ssl branch July 20, 2015 09:46
@celsius celsius deleted the 0.11-devel-fix-disable-ssl branch July 20, 2015 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants