Opened 7 years ago

Closed 5 years ago

Last modified 4 years ago

#7735 closed (fixed)

IPv6 support for runserver

Reported by: jbalonso Owned by: jbalonso
Component: django-admin.py runserver Version: master
Severity: Keywords: ipv6
Cc: jalonso@…, nreilly@…, eromijn@…, lrekucki Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The runserver management command does not support IPv6 addresses. The attached patch does the following things (all relatively minor) to add that support:

  1. Adds an --ipv6, -6 option (default disabled) to runserver's options list.
  2. Adds a test for socket.AF_INET6. If it's missing, raise a command error about IPv6 support in Python.
  3. Change the addr:port split code from split(':') to rsplit(':',1).
  4. Change the default address from 127.0.0.1 to ::1 when IPv6 is being enabled.
  5. Signals the run routine from django.core.servers.basehttp by a named enable_ipv6 parameter.
  6. Change the aforementioned run routine to declare and use, only when enable_ipv6 is true, a WSGIServerV6 class to override the default address family (set to AF_INET by python's SocketServer.TCPServer class).

Attachments (4)

runserver-ipv6-r7871.diff (2.9 KB) - added by jbalonso 7 years ago.
IPv6 support for runserver against rev 7871
runserver-ipv6-with-docs-r7920.diff (4.5 KB) - added by jbalonso 7 years ago.
IPv6 support for runserver and docs against rev 7920
runserver-ipv6-with-docs-r13350.diff (5.3 KB) - added by lrekucki 5 years ago.
I took the liberty to update a patch to revision 13350. One important change, is that the URL for IPv6 should be http://[address]:port/ (with brackets).
ticket7735.diff (9.3 KB) - added by lrekucki 5 years ago.
Updated patch: Use "[200::addr:1]:port" format for IPv6 and detect it. Enable ipv6 in testserver.

Download all attachments as: .zip

Change History (18)

Changed 7 years ago by jbalonso

IPv6 support for runserver against rev 7871

comment:1 Changed 7 years ago by Alex

  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by jbalonso

  • Cc jalonso@… added

comment:3 Changed 7 years ago by programmerq

  • milestone set to post-1.0

I'm definitely a huge +1 on this. Marking as post-1.0 because it isn't necessary to get 1.0 out the door. It is too small a feature to but on the official "maybe" list, but if the patch works now I see no reason to delay it past the 1.0 release.

comment:4 Changed 7 years ago by jbalonso

  • Needs documentation unset
  • Owner changed from nobody to jbalonso
  • Status changed from new to assigned

I'm posting an updated patch, now with improved paying-attention-to-directions (I didn't run svn diff from the root of trunk the first time around) and documentation. I did my best to blend in my documentation with existing style, but I encourage extra scrutiny on my first contribution.

Changed 7 years ago by jbalonso

IPv6 support for runserver and docs against rev 7920

comment:5 Changed 7 years ago by anonymous

  • Cc nreilly@… added

comment:6 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:7 follow-up: Changed 5 years ago by erikr

Is jbalonso still tracking this ticket? It's been quiet for a year.

Also, why is this in design decision needed? It seems like a pretty normal thing to add, and the patch seems OK (although it will probably need updating to apply cleanly to trunk).

comment:8 Changed 5 years ago by erikr

  • Cc eromijn@… added

comment:9 in reply to: ↑ 7 Changed 5 years ago by jbalonso

Replying to erikr:

Is jbalonso still tracking this ticket? It's been quiet for a year.

Yes, I'm still here. It's been closer to two years, actually.

Also, why is this in design decision needed? It seems like a pretty normal thing to add, and the patch seems OK (although it will probably need updating to apply cleanly to trunk).

I haven't been keeping the patch up-to-date (or even checking, for that matter), because I wanted to hear a "Yes, we'll take that" rather than chasing trunk on a whim and a prayer.

That said, I'd happily brush it up again.

comment:10 Changed 5 years ago by russellm

  • milestone set to 1.3
  • Patch needs improvement set
  • Triage Stage changed from Design decision needed to Accepted

Changed 5 years ago by lrekucki

I took the liberty to update a patch to revision 13350. One important change, is that the URL for IPv6 should be http://[address]:port/ (with brackets).

comment:11 Changed 5 years ago by jbalonso

Awesome! You beat me to the punch by about a day--I had just pulled trunk to work on updating my patch. I like your more-compact style better.

Changed 5 years ago by lrekucki

Updated patch: Use "[200::addr:1]:port" format for IPv6 and detect it. Enable ipv6 in testserver.

comment:12 Changed 5 years ago by lrekucki

  • Cc lrekucki added
  • Patch needs improvement unset

comment:13 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14711]) Fixed #7735 -- Added support for IPv6 adresses to runserver and testserver management command. Thanks to Jason Alonso and Łukasz Rekucki for the report and initial patches.

comment:14 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top