prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  SRM to HTTPS optional compatibility
  Motivation
  ----------
  https://github.com/rucio/rucio/blob/882b662a24c75d515080606be635959566b17f14/lib/rucio/common/constants.py#L42
  Defines a scheme_map between protocol compatibility in Rucio. We need an additional compatibility between `srm` and `https` (and vice-versa) which is only optionally (based on a config parameter) activated.
  
  Modification
  ------------
  Check if an option
  ```
  [transfers]
  srm_https_compatibility = True
  ```
  is set and add it to the scheme_map.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/rucio/common/constants.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2013-2021 CERN
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #    http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 #
  16 # Authors:
  17 # - Vincent Garonne <vincent.garonne@cern.ch>, 2013-2015
  18 # - Cedric Serfon <cedric.serfon@cern.ch>, 2015-2021
  19 # - Martin Barisits <martin.barisits@cern.ch>, 2017
  20 # - Mario Lassnig <mario.lassnig@cern.ch>, 2018-2021
  21 # - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018
  22 # - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021
  23 # - David Población Criado <david.poblacion.criado@cern.ch>, 2021
  24 # - Rakshita Varadarajan <rakshitajps@gmail.com>, 2021
  25 
  26 from collections import namedtuple
  27 from enum import Enum
  28 
  29 """
  30 Constants.
  31 
  32 """
  33 
  34 RESERVED_KEYS = ['scope', 'name', 'account', 'did_type', 'is_open', 'monotonic', 'obsolete', 'complete',
  35                  'availability', 'suppressed', 'bytes', 'length', 'md5', 'adler32', 'rule_evaluation_action',
  36                  'rule_evaluation_required', 'expired_at', 'deleted_at', 'created_at', 'updated_at']
  37 # collection_keys =
  38 # file_keys =
  39 
  40 KEY_TYPES = ['ALL', 'COLLECTION', 'FILE', 'DERIVED']
  41 # all(container, dataset, file), collection(dataset or container), file, derived(compute from file for collection)
  42 
  43 SCHEME_MAP = {'srm': ['srm', 'gsiftp'],
  44               'gsiftp': ['srm', 'gsiftp'],
  45               'https': ['https', 'davs', 's3', 'srm+https'],
  46               'davs': ['https', 'davs', 's3', 'srm+https'],
  47               'root': ['root'],
  48               's3': ['https', 'davs', 's3', 'srm+https'],
  49               'srm+https': ['https', 'davs', 's3', 'srm+https'],
  50               'scp': ['scp'],
  51               'rsync': ['rsync'],
  52               'rclone': ['rclone']}
  53 
  54 SUPPORTED_PROTOCOLS = ['gsiftp', 'srm', 'root', 'davs', 'http', 'https', 'file', 's3', 's3+rucio', 's3+https', 'storm', 'srm+https', 'scp', 'rsync', 'rclone']
  55 
  56 FTS_STATE = namedtuple('FTS_STATE', ['SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY', 'NOT_USED',
  57                                      'CANCELED'])('SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY',
  58                                                   'NOT_USED', 'CANCELED')
  59 
  60 FTS_COMPLETE_STATE = namedtuple('FTS_COMPLETE_STATE', ['OK', 'ERROR'])('Ok', 'Error')
  61 
  62 
  63 class ReplicaState(Enum):
  64     # From rucio.db.sqla.constants, update that file at the same time than this
  65     AVAILABLE = 'A'
  66     UNAVAILABLE = 'U'
  67     COPYING = 'C'
  68     BEING_DELETED = 'B'
  69     BAD = 'D'
  70     TEMPORARY_UNAVAILABLE = 'T'
  71
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/rucio/common/constants.py b/lib/rucio/common/constants.py
  --- a/lib/rucio/common/constants.py
  +++ b/lib/rucio/common/constants.py
  @@ -21,11 +21,15 @@
   # - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018
   # - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021
   # - David Población Criado <david.poblacion.criado@cern.ch>, 2021
  +# - Radu Carpa <radu.carpa@cern.ch>, 2021
   # - Rakshita Varadarajan <rakshitajps@gmail.com>, 2021
  +# - Joel Dierkes <joel.dierkes@cern.ch>, 2021
   
   from collections import namedtuple
   from enum import Enum
   
  +from rucio.common.config import config_get
  +
   """
   Constants.
   
  @@ -50,6 +54,9 @@
                 'scp': ['scp'],
                 'rsync': ['rsync'],
                 'rclone': ['rclone']}
  +if config_get('transfers', 'srm_https_compatibility', raise_exception=False, default=False):
  +    SCHEME_MAP['srm'].append('https')
  +    SCHEME_MAP['https'].append('srm')
   
   SUPPORTED_PROTOCOLS = ['gsiftp', 'srm', 'root', 'davs', 'http', 'https', 'file', 's3', 's3+rucio', 's3+https', 'storm', 'srm+https', 'scp', 'rsync', 'rclone']
  
verification_info: {"golden_diff": "diff --git a/lib/rucio/common/constants.py b/lib/rucio/common/constants.py\n--- a/lib/rucio/common/constants.py\n+++ b/lib/rucio/common/constants.py\n@@ -21,11 +21,15 @@\n # - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018\n # - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021\n # - David Poblaci\u00f3n Criado <david.poblacion.criado@cern.ch>, 2021\n+# - Radu Carpa <radu.carpa@cern.ch>, 2021\n # - Rakshita Varadarajan <rakshitajps@gmail.com>, 2021\n+# - Joel Dierkes <joel.dierkes@cern.ch>, 2021\n \n from collections import namedtuple\n from enum import Enum\n \n+from rucio.common.config import config_get\n+\n \"\"\"\n Constants.\n \n@@ -50,6 +54,9 @@\n               'scp': ['scp'],\n               'rsync': ['rsync'],\n               'rclone': ['rclone']}\n+if config_get('transfers', 'srm_https_compatibility', raise_exception=False, default=False):\n+    SCHEME_MAP['srm'].append('https')\n+    SCHEME_MAP['https'].append('srm')\n \n SUPPORTED_PROTOCOLS = ['gsiftp', 'srm', 'root', 'davs', 'http', 'https', 'file', 's3', 's3+rucio', 's3+https', 'storm', 'srm+https', 'scp', 'rsync', 'rclone']\n", "issue": "SRM to HTTPS optional compatibility\nMotivation\r\n----------\r\nhttps://github.com/rucio/rucio/blob/882b662a24c75d515080606be635959566b17f14/lib/rucio/common/constants.py#L42\r\nDefines a scheme_map between protocol compatibility in Rucio. We need an additional compatibility between `srm` and `https` (and vice-versa) which is only optionally (based on a config parameter) activated.\r\n\r\nModification\r\n------------\r\nCheck if an option\r\n```\r\n[transfers]\r\nsrm_https_compatibility = True\r\n```\r\nis set and add it to the scheme_map.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2013-2021 CERN\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n# Authors:\n# - Vincent Garonne <vincent.garonne@cern.ch>, 2013-2015\n# - Cedric Serfon <cedric.serfon@cern.ch>, 2015-2021\n# - Martin Barisits <martin.barisits@cern.ch>, 2017\n# - Mario Lassnig <mario.lassnig@cern.ch>, 2018-2021\n# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018\n# - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021\n# - David Poblaci\u00f3n Criado <david.poblacion.criado@cern.ch>, 2021\n# - Rakshita Varadarajan <rakshitajps@gmail.com>, 2021\n\nfrom collections import namedtuple\nfrom enum import Enum\n\n\"\"\"\nConstants.\n\n\"\"\"\n\nRESERVED_KEYS = ['scope', 'name', 'account', 'did_type', 'is_open', 'monotonic', 'obsolete', 'complete',\n                 'availability', 'suppressed', 'bytes', 'length', 'md5', 'adler32', 'rule_evaluation_action',\n                 'rule_evaluation_required', 'expired_at', 'deleted_at', 'created_at', 'updated_at']\n# collection_keys =\n# file_keys =\n\nKEY_TYPES = ['ALL', 'COLLECTION', 'FILE', 'DERIVED']\n# all(container, dataset, file), collection(dataset or container), file, derived(compute from file for collection)\n\nSCHEME_MAP = {'srm': ['srm', 'gsiftp'],\n              'gsiftp': ['srm', 'gsiftp'],\n              'https': ['https', 'davs', 's3', 'srm+https'],\n              'davs': ['https', 'davs', 's3', 'srm+https'],\n              'root': ['root'],\n              's3': ['https', 'davs', 's3', 'srm+https'],\n              'srm+https': ['https', 'davs', 's3', 'srm+https'],\n              'scp': ['scp'],\n              'rsync': ['rsync'],\n              'rclone': ['rclone']}\n\nSUPPORTED_PROTOCOLS = ['gsiftp', 'srm', 'root', 'davs', 'http', 'https', 'file', 's3', 's3+rucio', 's3+https', 'storm', 'srm+https', 'scp', 'rsync', 'rclone']\n\nFTS_STATE = namedtuple('FTS_STATE', ['SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY', 'NOT_USED',\n                                     'CANCELED'])('SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY',\n                                                  'NOT_USED', 'CANCELED')\n\nFTS_COMPLETE_STATE = namedtuple('FTS_COMPLETE_STATE', ['OK', 'ERROR'])('Ok', 'Error')\n\n\nclass ReplicaState(Enum):\n    # From rucio.db.sqla.constants, update that file at the same time than this\n    AVAILABLE = 'A'\n    UNAVAILABLE = 'U'\n    COPYING = 'C'\n    BEING_DELETED = 'B'\n    BAD = 'D'\n    TEMPORARY_UNAVAILABLE = 'T'\n", "path": "lib/rucio/common/constants.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2013-2021 CERN\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n# Authors:\n# - Vincent Garonne <vincent.garonne@cern.ch>, 2013-2015\n# - Cedric Serfon <cedric.serfon@cern.ch>, 2015-2021\n# - Martin Barisits <martin.barisits@cern.ch>, 2017\n# - Mario Lassnig <mario.lassnig@cern.ch>, 2018-2021\n# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018\n# - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021\n# - David Poblaci\u00f3n Criado <david.poblacion.criado@cern.ch>, 2021\n# - Radu Carpa <radu.carpa@cern.ch>, 2021\n# - Rakshita Varadarajan <rakshitajps@gmail.com>, 2021\n# - Joel Dierkes <joel.dierkes@cern.ch>, 2021\n\nfrom collections import namedtuple\nfrom enum import Enum\n\nfrom rucio.common.config import config_get\n\n\"\"\"\nConstants.\n\n\"\"\"\n\nRESERVED_KEYS = ['scope', 'name', 'account', 'did_type', 'is_open', 'monotonic', 'obsolete', 'complete',\n                 'availability', 'suppressed', 'bytes', 'length', 'md5', 'adler32', 'rule_evaluation_action',\n                 'rule_evaluation_required', 'expired_at', 'deleted_at', 'created_at', 'updated_at']\n# collection_keys =\n# file_keys =\n\nKEY_TYPES = ['ALL', 'COLLECTION', 'FILE', 'DERIVED']\n# all(container, dataset, file), collection(dataset or container), file, derived(compute from file for collection)\n\nSCHEME_MAP = {'srm': ['srm', 'gsiftp'],\n              'gsiftp': ['srm', 'gsiftp'],\n              'https': ['https', 'davs', 's3', 'srm+https'],\n              'davs': ['https', 'davs', 's3', 'srm+https'],\n              'root': ['root'],\n              's3': ['https', 'davs', 's3', 'srm+https'],\n              'srm+https': ['https', 'davs', 's3', 'srm+https'],\n              'scp': ['scp'],\n              'rsync': ['rsync'],\n              'rclone': ['rclone']}\nif config_get('transfers', 'srm_https_compatibility', raise_exception=False, default=False):\n    SCHEME_MAP['srm'].append('https')\n    SCHEME_MAP['https'].append('srm')\n\nSUPPORTED_PROTOCOLS = ['gsiftp', 'srm', 'root', 'davs', 'http', 'https', 'file', 's3', 's3+rucio', 's3+https', 'storm', 'srm+https', 'scp', 'rsync', 'rclone']\n\nFTS_STATE = namedtuple('FTS_STATE', ['SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY', 'NOT_USED',\n                                     'CANCELED'])('SUBMITTED', 'READY', 'ACTIVE', 'FAILED', 'FINISHED', 'FINISHEDDIRTY',\n                                                  'NOT_USED', 'CANCELED')\n\nFTS_COMPLETE_STATE = namedtuple('FTS_COMPLETE_STATE', ['OK', 'ERROR'])('Ok', 'Error')\n\n\nclass ReplicaState(Enum):\n    # From rucio.db.sqla.constants, update that file at the same time than this\n    AVAILABLE = 'A'\n    UNAVAILABLE = 'U'\n    COPYING = 'C'\n    BEING_DELETED = 'B'\n    BAD = 'D'\n    TEMPORARY_UNAVAILABLE = 'T'\n", "path": "lib/rucio/common/constants.py"}]}