crossbario / crossbario/autobahn-python

Support fully general websocket origin URLs

Open
#1,302 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug websocket
Dominant language
Python
Stars
2.5k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm embedding my webpage inside a QWebEngine (https://doc.qt.io/qt-5/qtwebengine-overview.html). This Webengine access local files via qrc:// instead of file:// for Chrome.

The problem is, the _url_to_origin(url) function does handle the Chrome or Firefox case but not the QWebengine page and I have no way to change the origin in my webengine so my websocket connections fail (('HTTP Origin header invalid: No host part in Origin 'qrc://'').

Adding this to _url_to_origin() will handle the case:
if scheme == 'qrc':
# when browsing local files, QtWebEngine sends qrc:// URLs
return 'null'

Contributor guide

Open the contributing guide

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.

Research direction

Start at the _url_to_origin(url) function mentioned in the issue and trace how qrc:// origins reach websocket origin validation. Confirm that QWebEngine local pages no longer fail with the reported invalid Origin error, and run the relevant existing tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.