Skip to content
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

configurable http #3884

Merged
merged 3 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions c2cgeoportal/lib/lingua_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,14 @@ def _import(object_type, messages, callback=None):
if callback is not None:
callback(item, messages)

def _get_http(self):
http_options = self.config.get("http_options")
disable_ssl_certificate_validation = False
if http_options is not None:
disable_ssl_certificate_validation = http_options.get("disable_ssl_certificate_validation", False)
http = httplib2.Http(disable_ssl_certificate_validation=disable_ssl_certificate_validation)
return http
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simpler:

return httplib2.Http(**self.config.get("http_options", {}))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks


def _import_layer_wms(self, layer, messages):
server = layer.ogc_server
url = server.url_wfs or server.url
Expand Down Expand Up @@ -472,7 +480,7 @@ def _layer_attributes(self, url, layer):
self.wmscap_cache[url] = None

# forward request to target (without Host Header)
http = httplib2.Http()
http = self._get_http()
h = {}
if hostname == "localhost": # pragma: no cover
h["Host"] = self.package["host"]
Expand Down Expand Up @@ -515,7 +523,7 @@ def _layer_attributes(self, url, layer):
self.featuretype_cache[url] = None

# forward request to target (without Host Header)
http = httplib2.Http()
http = self._get_http()
h = {}
if hostname == "localhost": # pragma: no cover
h["Host"] = self.package["host"]
Expand Down
2 changes: 1 addition & 1 deletion c2cgeoportal/scaffolds/update/CONST_Makefile_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ CONFIG_VARS += instanceid sqlalchemy.url schema parentschema enable_admin_interf
raster shortener hide_capabilities mapserverproxy tinyowsproxy resourceproxy print_url \
tiles_url checker check_collector default_max_age jsbuild package srid \
reset_password fulltextsearch headers authorized_referers hooks stats db_chooser \
ogcproxy_enable dbsessions urllogin host_forward_host smtp
ogcproxy_enable dbsessions urllogin host_forward_host smtp http_options
MAKE_FILES = $(shell ls -1 *.mk) CONST_Makefile

# Disabling Make built-in rules to speed up execution time
Expand Down
4 changes: 4 additions & 0 deletions c2cgeoportal/scaffolds/update/CONST_vars.yaml_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ vars:
# architecture.
external_themes_url:

# Available options for http sessions created within c2cgeoportal
http_options:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be added in CONST_config-schema.yaml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

disable_ssl_certificate_validation: False

urllogin: {}

mapserverproxy:
Expand Down