允许Web套接字的content-security-policy元标记(content-security-policy meta tag for allowing web socket)
情况:由content-security-policy元标记阻止的
phonegap serve
的自动phonegap serve
添加内容安全策略可防止自动重新加载
phonegap serve
实用程序。 这是建立在cordova serve
之上,但在文件编辑时自动重新加载应用程序。 它的工作原理是在index.html
注入socket.io
。 我应该在我的CSP元标记中指定哪些内容允许套接字连接到我的笔记本电脑。这是我目前的CSP元标记:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 192.168.0.100 * ws:* ; connect-src ws://192.168.0.100 ws:*">
但是在打开时,设备会一直显示“正在连接到设备”,而不会在设备上收到事件。
另请注意,它开始处理删除此元标记,这意味着
cordova-plugin-whitelist
可能无法阻止它。Situation: autoreload of
phonegap serve
blocked by content-security-policy meta tagAdding content security policy prevents auto-reload of
phonegap serve
utility. This is built on top ofcordova serve
but auto-reloads the app on file editing. It works by injectingsocket.io
inindex.html
. What should I specify in my CSP meta tag that will allow socket connections to my laptop.Here is my current CSP meta tag:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 192.168.0.100 * ws:* ; connect-src ws://192.168.0.100 ws:*">
However on opening, the device keeps showing "Connecting to device" and not event is received on the device.
Also note that it starts working on removing this meta tag which mean the
cordova-plugin-whitelist
might not be blocking it.
原文:https://stackoverflow.com/questions/32986074
满意答案
事实证明,这些设备使用标准的Silicon Labs CP2102接口芯片,设备制造商加载了自定义
idProduct
编号。 虽然芯片与cp210x.ko
驱动程序100%兼容,但系统无法识别idProduct
,也不会将驱动程序与其关联。此时,有几种可能的解决方案:
- 手动指示系统将
cp210x.ko
驱动程序与此idProduct
一起使用。- 将
idProduct
添加到开源驱动程序 ,编译并安装它。 然后尝试将更改推送到标准Linux存储库。- 用通用芯片替换定制芯片。
- 重写芯片上的
idProduct
。我选择重写
idProduct
。 Silicon Labs有一个免费的实用程序可以做到这一点。 我设置了idProduct=EA60
,这是该芯片的默认设置。 该设备现在可以通过标准内置驱动程序识别,并且工作正常。It turns out this devices uses a standard Silicon Labs CP2102 interface chip, which the device manufacturer loaded with a custom
idProduct
number. While the chip is 100% compatible with thecp210x.ko
driver, theidProduct
is not recognized by the system, and does not associate the driver with it.At this point, there are several possible solutions:
- Manually direct the system to use the
cp210x.ko
driver with thisidProduct
.- Add the
idProduct
to the open source driver, compile, and install it. Then try to push the changes into standard Linux repositories.- Replace the customized chip with generic one.
- Rewrite the
idProduct
on the chip.I chose to rewrite the
idProduct
. Silicon Labs has a free utility to do just this. I set theidProduct=EA60
, which is the default for this chip. The device is now recognized by the standard built-in driver, and works perfectly.
相关问答
更多t420 integrated camera linux 摄像头在什么地方下载呀
适用于Linux的虚拟串行端口(Virtual Serial Port for Linux)
Linux上的Cygnal Integrated Products串口(Cygnal Integrated Products serial port on Linux)
linux中的串口(raspbian)(serial port in linux (raspbian))
Linux串口优先级(Linux serial port priority)
Linux - 与C的多串口通信(Linux - Multiple Serial Port Communication with C)
Linux - 与设备关联的端口(Linux - port associated to a device)
如果我使用串口控制台登录linux,是使用terminfo还是termcap?(If I login linux using serial port console, does it using the terminfo or termcap?)
Linux上的软件串口环回(Software serial port loopback on linux)
在Qt中选择串口(Linux)(Selecting serial port in Qt(Linux))
相关文章
更多关于微信公众号内嵌网页的几个meta标签
Web scraper open source
HTML meta标签
JAVA WEB
修改Linux Socket最大连接数
微信公众平台如何与Web App结合?
微信公众平台如何与Web App结合?
Hibernate在Web应用程序中使用示例
3年swing,1年JavaEE,1年java socket转android什么待遇
HTML5 Web SQL Database 数据库
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!