#33700: APPEND_SLASH adds significant latency to all requests not ending in / 
(even
if successful)
-------------------------------------+-------------------------------------
     Reporter:  Anders Kaseorg       |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  HTTP handling        |                  Version:  4.0
     Severity:  Normal               |               Resolution:
     Keywords:  CommonMiddleware     |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 The Zulip middleware there...


 {{{
     def should_redirect_with_slash(self, request: HttpRequest) -> bool:
          if settings.RUNNING_INSIDE_TORNADO:
              return False
         return super().should_redirect_with_slash(request)
 }}}


 ... 🤔

 Looks like that would be simpler just doing `APPEND_SLASH =
 RUNNING_INSIDE_TORNADO` in the settings file, since
 `should_redirect_with_slash()` would always immediately return `False` in
 that case.

 > ... extra urlconf lookup for every request not ending with /, whether or
 not it succeeds as written.

 If you're not normalising URLs, I wonder if you don't `APPEND_SLASH =
 False` anyway?

 > ...performance impact was not considered...

 The assumption is that URLs without `/` are likely incorrect, so
 ''succeeding as written'' should be rare, i.e. not performance sensitive.

 I'm inclined to say `wontfix` — you're welcome to disable APPEND_SLASH, or
 implement a response only version of the middleware — or `needsinfo` at
 least pending a suggested patch (that doesn't break anything).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33700#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180b7af4809-2b1069cf-ef23-415a-9908-ea365f678d8d-000000%40eu-central-1.amazonses.com.

Reply via email to