Using Python HTTPSConnect

From PeformIQ Upgrade
Revision as of 14:49, 10 April 2017 by PeterHarding (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Problems

Had a problem where httplib.HTTPSConnect() was not available. Happens when Python is not built with SSL support. To get this working I need to do the following:

  1. . Download latest version of OpenSSL from http://www.openssl.org/ and install it (/usr/local/ssl)
  2. . Had to use the -fPIC compile flag to get the linker to work later in the process
  3. . Update Modules/Setup file - uncomment SSL lines.
  4. . Build and install Python

Other things

In OpenSSL source directory run config as follows:

./config --openssldir=/usr/local/ssl

Add -fPIC to end of CFLAGS line in Makefile before building:

CFLAG= -DOPENSSL_THREADS -D_REENTRANT ... -DGHASH_ASM -fPIC


In python source directory run configure to build for a custom location:

./configure --enable-shared --prefix=/usr/local/python  LDFLAGS="-Wl,-rpath /usr/local/python/lib"

Also had a go at building pyOpenSSL. Once OpenSSL was installed needed to update the setup.py with the OpenSSL locations as follows:

 IncludeDirs = ['/usr/local/ssl/include']
 LibraryDirs = ['/usr/local/ssl/lib']