Opened 16 years ago

Closed 14 years ago

Last modified 13 years ago

#7735 closed (fixed)

IPv6 support for runserver

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

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 16 years ago.
IPv6 support for runserver against rev 7871
runserver-ipv6-with-docs-r7920.diff (4.5 KB ) - added by jbalonso 16 years ago.
IPv6 support for runserver and docs against rev 7920
runserver-ipv6-with-docs-r13350.diff (5.3 KB ) - added by Łukasz Rekucki 14 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 Łukasz Rekucki 14 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)

by jbalonso, 16 years ago

Attachment: runserver-ipv6-r7871.diff added

IPv6 support for runserver against rev 7871

comment:1 by Alex Gaynor, 16 years ago

Needs documentation: set
Triage Stage: UnreviewedDesign decision needed

comment:2 by jbalonso, 16 years ago

Cc: jalonso@… added

comment:3 by Jeff Anderson, 16 years ago

milestone: 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 by jbalonso, 16 years ago

Needs documentation: unset
Owner: changed from nobody to jbalonso
Status: newassigned

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.

by jbalonso, 16 years ago

IPv6 support for runserver and docs against rev 7920

comment:5 by anonymous, 16 years ago

Cc: nreilly@… added

comment:6 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:7 by Sasha Romijn, 14 years ago

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 by Sasha Romijn, 14 years ago

Cc: eromijn@… added

in reply to:  7 comment:9 by jbalonso, 14 years ago

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 by Russell Keith-Magee, 14 years ago

milestone: 1.3
Patch needs improvement: set
Triage Stage: Design decision neededAccepted

by Łukasz Rekucki, 14 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).

comment:11 by jbalonso, 14 years ago

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.

by Łukasz Rekucki, 14 years ago

Attachment: ticket7735.diff added

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

comment:12 by Łukasz Rekucki, 14 years ago

Cc: Łukasz Rekucki added
Patch needs improvement: unset

comment:13 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: assignedclosed

(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 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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