prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Gravatar default images do not load correctly
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `apps/authentication/templatetags/gravatar_url_resolver.py`
  Content:
  ```
  1 from django import template
  2 from django.conf import settings
  3 import urllib, hashlib
  4  
  5 register = template.Library()
  6 
  7 @register.assignment_tag(takes_context=True)
  8 def gravatar_url(context, user, size):
  9     default = "%s%s_%s.png" % (context['request'].META['HTTP_HOST'],
  10                                settings.DEFAULT_PROFILE_PICTURE_PREFIX, user.gender)
  11     gravatar_url = "https://www.gravatar.com/avatar/" + hashlib.md5(user.get_email().email).hexdigest() + "?"
  12     gravatar_url += urllib.urlencode({'d': default, 's':str(size)})
  13 
  14     return gravatar_url
  ```
  --- 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/apps/authentication/templatetags/gravatar_url_resolver.py b/apps/authentication/templatetags/gravatar_url_resolver.py
  --- a/apps/authentication/templatetags/gravatar_url_resolver.py
  +++ b/apps/authentication/templatetags/gravatar_url_resolver.py
  @@ -6,8 +6,11 @@
   
   @register.assignment_tag(takes_context=True)
   def gravatar_url(context, user, size):
  -    default = "%s%s_%s.png" % (context['request'].META['HTTP_HOST'],
  +
  +    prefix = "https://" if context['request'].is_secure() else "http://"
  +    default = "%s%s%s_%s.png" % (prefix, context['request'].META['HTTP_HOST'],
                                  settings.DEFAULT_PROFILE_PICTURE_PREFIX, user.gender)
  +
       gravatar_url = "https://www.gravatar.com/avatar/" + hashlib.md5(user.get_email().email).hexdigest() + "?"
       gravatar_url += urllib.urlencode({'d': default, 's':str(size)})
  
verification_info: {"golden_diff": "diff --git a/apps/authentication/templatetags/gravatar_url_resolver.py b/apps/authentication/templatetags/gravatar_url_resolver.py\n--- a/apps/authentication/templatetags/gravatar_url_resolver.py\n+++ b/apps/authentication/templatetags/gravatar_url_resolver.py\n@@ -6,8 +6,11 @@\n \n @register.assignment_tag(takes_context=True)\n def gravatar_url(context, user, size):\n-    default = \"%s%s_%s.png\" % (context['request'].META['HTTP_HOST'],\n+\n+    prefix = \"https://\" if context['request'].is_secure() else \"http://\"\n+    default = \"%s%s%s_%s.png\" % (prefix, context['request'].META['HTTP_HOST'],\n                                settings.DEFAULT_PROFILE_PICTURE_PREFIX, user.gender)\n+\n     gravatar_url = \"https://www.gravatar.com/avatar/\" + hashlib.md5(user.get_email().email).hexdigest() + \"?\"\n     gravatar_url += urllib.urlencode({'d': default, 's':str(size)})\n", "issue": "Gravatar default images do not load correctly\n\n", "before_files": [{"content": "from django import template\nfrom django.conf import settings\nimport urllib, hashlib\n \nregister = template.Library()\n\n@register.assignment_tag(takes_context=True)\ndef gravatar_url(context, user, size):\n    default = \"%s%s_%s.png\" % (context['request'].META['HTTP_HOST'],\n                               settings.DEFAULT_PROFILE_PICTURE_PREFIX, user.gender)\n    gravatar_url = \"https://www.gravatar.com/avatar/\" + hashlib.md5(user.get_email().email).hexdigest() + \"?\"\n    gravatar_url += urllib.urlencode({'d': default, 's':str(size)})\n\n    return gravatar_url", "path": "apps/authentication/templatetags/gravatar_url_resolver.py"}], "after_files": [{"content": "from django import template\nfrom django.conf import settings\nimport urllib, hashlib\n \nregister = template.Library()\n\n@register.assignment_tag(takes_context=True)\ndef gravatar_url(context, user, size):\n\n    prefix = \"https://\" if context['request'].is_secure() else \"http://\"\n    default = \"%s%s%s_%s.png\" % (prefix, context['request'].META['HTTP_HOST'],\n                               settings.DEFAULT_PROFILE_PICTURE_PREFIX, user.gender)\n\n    gravatar_url = \"https://www.gravatar.com/avatar/\" + hashlib.md5(user.get_email().email).hexdigest() + \"?\"\n    gravatar_url += urllib.urlencode({'d': default, 's':str(size)})\n\n    return gravatar_url", "path": "apps/authentication/templatetags/gravatar_url_resolver.py"}]}