Add ability to set custom Origin header

Open
#153 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
networking

Research direction

Start by locating the threaded client constructor and its header-building code. Check how the headers parameter is combined with the default Origin, then verify that an override replaces it and that the fallback uses schema://host[:port] rather than the full URL.

Written by the indexing model from the issue text.

Description

It is sometimes useful to be able to set a custom Origin header.

There is a 'headers' parameter to the client constructor (threaded client), where you can provide a new Origin header, but it is appended to the headers which already have an Origin value. Servers ignore duplicate Origin values.

I suggest changing the header code to allow the default Origin header to be overwritten by an Origin entry in the headers parameter.

Also, in the absence of an over-riding Origin header, the default should be schema://host[:port] per rfc 6454, not the full url.

I can provide a patch if you wish.

Dominant language
Python
Stars
1.1k
Forks
285
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Lawouach/WebSocket-for-Python

All issues in Lawouach/WebSocket-for-Python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.