prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Gravatar default images do not load correctly
  
  
  </issue>
  <code>
  [start of apps/authentication/templatetags/gravatar_url_resolver.py]
  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 of apps/authentication/templatetags/gravatar_url_resolver.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
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"}]}