Files
app-store-optimization/skills/loki-mode/benchmarks/results/2026-01-05-01-35-39/swebench-patches/django__django-11848.patch

19 lines
672 B
Diff

--- a/django/utils/http.py
+++ b/django/utils/http.py
@@ -176,10 +176,11 @@ def parse_http_date(date):
raise ValueError("%r is not a valid date" % date)
try:
year = int(m.group('year'))
- if year < 100:
- if year < 70:
- year += 2000
- else:
- year += 1900
+ if year < 100:
+ current_year = datetime.datetime.utcnow().year
+ year += 100 * (current_year // 100)
+ if year > current_year + 50:
+ year -= 100
month = MONTHS.index(m.group('mon').lower()) + 1
day = int(m.group('day'))
hour = int(m.group('hour'))