Skip to content

Commit

Permalink
#296 ClientConnectorSSLError and attachment filenames bugs fix (#297)
Browse files Browse the repository at this point in the history
* #296 ClientConnectorSSLError bug fix.
Replaced client_auth purpose with server_auth in ssl context creation in order to authenticate web servers. This fix the ssl context issue with Python 3.10.
For the same occasion, we updated rest.py generated code to use a DataForm that does not encode attachment files. aioHttp dataForm object always encodes attachments filenames in utf-8 by default.
  • Loading branch information
symphony-soufiane authored Jun 24, 2022
1 parent ceb223c commit 70137a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions api_client_generation/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ generate_files() {
rm __init__.py # we don't care about __init__.py files
cp *.py $project_root/symphony/bdk/gen/${name}_model

# update rest.py
cd $code_gen_dir/output/symphony/bdk/gen
cp rest.py $project_root/symphony/bdk/gen/rest.py

# remove downloaded files
cd $code_gen_dir
rm -r output
Expand All @@ -53,6 +57,7 @@ generate_files() {
then
rm $support_file_name
fi

}

generate_files agent ${api_spec_base_url}/agent/agent-api-public-deprecated.yaml
Expand Down
Binary file modified api_client_generation/openapi-generator-cli.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions symphony/bdk/gen/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None):
if maxsize is None:
maxsize = configuration.connection_pool_maxsize

ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH, cafile=configuration.ssl_ca_cert)
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=configuration.ssl_ca_cert)
ssl_context.load_default_certs()
ssl_context.verify_mode = ssl.CERT_REQUIRED

Expand Down Expand Up @@ -140,7 +140,7 @@ async def request(self, method, url, query_params=None, headers=None,
# must del headers['Content-Type'], or the correct
# Content-Type which generated by aiohttp
del headers['Content-Type']
data = aiohttp.FormData()
data = aiohttp.FormData(quote_fields=False)
for param in post_params:
k, v = param
if isinstance(v, tuple) and len(v) == 3:
Expand Down

0 comments on commit 70137a8

Please sign in to comment.