Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21f6e50

Browse files
authored
Merge pull request #25071 from meeseeksmachine/auto-backport-of-pr-25039-on-v3.7.x
Backport PR #25039 on branch v3.7.x (Updated WebAgg JS to check and send request over wss if using HTTPS)
2 parents bf2af86 + 66953b7 commit 21f6e50

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/matplotlib/backends/web_backend/all_figures.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
figure_div.id = "figure-div";
2525
main_div.appendChild(figure_div);
2626
var websocket_type = mpl.get_websocket_type();
27-
var websocket = new websocket_type("{{ ws_uri }}" + fig_id + "/ws");
27+
var uri = "{{ ws_uri }}" + fig_id + "/ws";
28+
if (window.location.protocol === "https:") uri = uri.replace('ws:', 'wss:')
29+
var websocket = new websocket_type(uri);
2830
var fig = new mpl.figure(fig_id, websocket, mpl_ondownload, figure_div);
2931

3032
fig.focus_on_mouseover = true;

lib/matplotlib/backends/web_backend/single_figure.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
ready(
2020
function () {
2121
var websocket_type = mpl.get_websocket_type();
22-
var websocket = new websocket_type(
23-
"{{ ws_uri }}" + {{ str(fig_id) }} + "/ws");
22+
var uri = "{{ ws_uri }}" + {{ str(fig_id) }} + "/ws";
23+
if (window.location.protocol === 'https:') uri = uri.replace('ws:', 'wss:')
24+
var websocket = new websocket_type(uri);
2425
var fig = new mpl.figure(
2526
{{ str(fig_id) }}, websocket, mpl_ondownload,
2627
document.getElementById("figure"));

0 commit comments

Comments
 (0)