Opened 4 weeks ago
Closed 3 weeks ago
#37277 closed Bug (duplicate)
Extending URLField to Support WebSocket Schemas (ws:// & wss://)
| Reported by: | sepehrnorouzi | Owned by: | sepehrnorouzi |
|---|---|---|---|
| Component: | Core (Other) | Version: | 6.1 |
| Severity: | Normal | Keywords: | URLField, wss, websocket, validator |
| Cc: | sepehrnorouzi | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Hi everyone,
I'd like to flag a blocker regarding our model fields—the current URLField validator rejects ws:// and wss:// schemas, which prevents us from storing WebSocket server endpoints.
I've already prepared a fix that adds the necessary schemes and includes the accompanying test suite. The branch is fully ready for peer review.
However, I'm running into a permissions blocker and cannot push the branch to our remote repository at the moment. Could someone please either grant me write access to the required branch or let me know the preferred way to submit this change?
Thanks in advance!
Attachments (1)
Change History (3)
by , 4 weeks ago
| Attachment: | validators.py added |
|---|
comment:1 by , 4 weeks ago
| Cc: | added |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
comment:2 by , 3 weeks ago
| Component: | Core (URLs) → Core (Other) |
|---|---|
| Easy pickings: | unset |
| Resolution: | → duplicate |
| Status: | assigned → closed |
| Summary: | Update: Extending URLField to Support WebSocket Schemas (ws:// & wss://) → Extending URLField to Support WebSocket Schemas (ws:// & wss://) |
A similar request has been made a number of times, including #31063 and #26418. They were closed as changing the default schemes is backward incompatible.
You can use URLValidator to add schemes for your own needs. For example.
class MyURLField(models.URLField):
default_validators = [URLValidator(schemes=["http", "https", "ws", "wss"])]
I have the tests and the doc changes.