If you use HTTPS (which is essentially HTTP over SSL / TLS), all HTTP traffic will be encrypted from the moment you establish an SSL / TLS connection (provided that you use the appropriate cipher suites) that it is before any HTTP message . Only the server certificate (which can indicate the host name) will be visible and possibly the client certificate in some cases (if you also use client certificate authentication). URLs and all HTTP headers (and content) will be protected by SSL / TLS in this way.
If you are not using the browser as a client, you can use existing SSL / TLS libraries such as NSS (Mozilla) or OpenSSL. Ensure that you have correctly configured certificate trust and host name verification.
Bruno
source share