Testing a new resource with basic auth gives errors
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- api, authentication, backend
调研方向
从 GeoHealthCheck/healthcheck.py 中的 sniff_test_resource 开始,traceback 将其标识为测试资源的入口点。跟踪未保存资源的 basic-auth 凭据和标题如何传递到 OWS WMS 请求中,然后将这一路径与测试已保存资源时的路径进行比较。当初始 Test 操作使用所提供的凭据并显示资源标题,且不跟随未经身份验证的登录响应时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
When I'm adding a new WMS resource, specify "Basic Authentication" username + password, and then press the "Test" button at the Action row at the bottom of the page, I'm getting a result indicating that the test has failed. Details:
{
"end_time": "2021-06-29T11:53:03Z",
"message": "(, XMLSyntaxError('xmlParseEntityRef: no name, line 18, column 48'), )",
"probes": [
{
"checks": [
{
"check_id": 9,
"class": "GeoHealthCheck.plugins.check.checks.HttpStatusNoError",
"message": "OK",
"name": "HTTP status should not be errored",
"response_time": -1,
"success": true
},
{
"check_id": 10,
"class": "GeoHealthCheck.plugins.check.checks.XmlParse",
"message": "(, XMLSyntaxError('xmlParseEntityRef: no name, line 18, column 48'), )",
"name": "Valid XML response",
"response_time": "0.167",
"success": false
},
{
"check_id": 11,
"class": "GeoHealthCheck.plugins.check.checks.NotContainsOwsException",
"message": "OK",
"name": "Response NOT contains OWS Exception",
"response_time": "0.14",
"success": true
},
{
"check_id": 12,
"class": "GeoHealthCheck.plugins.check.checks.ContainsStrings",
"message": "Title> not in response text",
"name": "Response contains strings",
"response_time": "0.13",
"success": false
}
],
"class": "GeoHealthCheck.plugins.probe.owsgetcaps.WmsGetCaps",
"message": "(, XMLSyntaxError('xmlParseEntityRef: no name, line 18, column 48'), )",
"name": "WMS GetCapabilities",
"probe_id": 3,
"response_time": "0.170545",
"success": false
}
],
"report_version": "1",
"resource_id": 2,
"resource_title": "Untitled",
"resource_type": "OGC:WMS",
"response_time": "0.177604",
"start_time": "2021-06-29T11:53:03Z",
"success": false,
"url": "<my url>"
}
I was expecting a successful test result. When I save and close the resource, reopen it and then press "Test now", then the test passes successfully. Also when I press "Edit" and then the same "Test" button as in the beginning, the test succeeds. It is as if the credentials aren't used when the new check isn't saved to the database yet.
Also note that the resource title is "Untitled", although I had already given the new resource a proper name before I performed the test.
Output of docker logs ghc_web:
2021-06-29 13:52:39,686 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): test.omgevingsserver.nl:443
2021-06-29 13:52:39,808 - urllib3.connectionpool - DEBUG - https://<my server>:443 "GET /bgt/ows?service=WMS&request=GetCapabilities&version=1.3.0 HTTP/1.1" 302 277
2021-06-29 13:52:39,845 - urllib3.connectionpool - DEBUG - https://<my server>:443 "GET /login.html?httpd_location=<path>?service=WMS&request=GetCapabilities&version=1.3.0 HTTP/1.1" 200 1309
2021-06-29 13:52:39,847 - healthcheck - WARNING - Cannot use functools.partial(<function WebMapService at 0x7fececd8a440>, version='1.3.0') on <my url>: xmlParseEntityRef: no name, line 18, column 48 (<string>, line 18)
Traceback (most recent call last):
File "/GeoHealthCheck/GeoHealthCheck/healthcheck.py", line 175, in sniff_test_resource
ows = ows_handler(url)
File "/venv/lib/python3.7/site-packages/owslib/wms.py", line 56, in WebMapService
timeout=timeout, headers=headers, auth=auth)
File "/venv/lib/python3.7/site-packages/owslib/map/wms130.py", line 75, in __init__
self._capabilities = reader.read(self.url, timeout=self.timeout)
File "/venv/lib/python3.7/site-packages/owslib/map/common.py", line 69, in read
return etree.fromstring(raw_text)
File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1896, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1784, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1141, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
File "<string>", line 18
lxml.etree.XMLSyntaxError: xmlParseEntityRef: no name, line 18, column 48
2021-06-29 13:52:39,852 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): <my server>:443
2021-06-29 13:52:39,972 - urllib3.connectionpool - DEBUG - https://<my server>:443 "GET /bgt/ows?service=WMS&request=GetCapabilities&version=1.1.1 HTTP/1.1" 302 277
2021-06-29 13:52:40,016 - urllib3.connectionpool - DEBUG - https://<my server>:443 "GET /login.html?httpd_location=/bgt/ows?service=WMS&request=GetCapabilities&version=1.1.1 HTTP/1.1" 200 1309
2021-06-29 13:52:40,019 - healthcheck - WARNING - Cannot use functools.partial(<function WebMapService at 0x7fececd8a440>, version='1.1.1') on <my url>: xmlParseEntityRef: no name, line 18, column 48 (<string>, line 18)
Traceback (most recent call last):
File "/GeoHealthCheck/GeoHealthCheck/healthcheck.py", line 175, in sniff_test_resource
ows = ows_handler(url)
File "/venv/lib/python3.7/site-packages/owslib/wms.py", line 52, in WebMapService
timeout=timeout, headers=headers, auth=auth)
File "/venv/lib/python3.7/site-packages/owslib/map/wms111.py", line 75, in __init__
self._capabilities = reader.read(self.url, timeout=self.timeout)
File "/venv/lib/python3.7/site-packages/owslib/map/common.py", line 69, in read
return etree.fromstring(raw_text)
File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1896, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1784, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1141, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
File "<string>", line 18
lxml.etree.XMLSyntaxError: xmlParseEntityRef: no name, line 18, column 48
2021-06-29 13:52:40,020 - healthcheck - ERROR - Getting metadata failed: Cannot get OGC:WMS service instance for <my url>
Traceback (most recent call last):
File "/GeoHealthCheck/GeoHealthCheck/healthcheck.py", line 183, in sniff_test_resource
raise ValueError(message)
ValueError: Cannot get OGC:WMS service instance for <my url>
Note the line with https://<my server>:443 "GET /login.html?httpd_location=<path>?service=WMS&request=GetCapabilities&version=1.3.0 HTTP/1.1. I've set up my web server in such a way that when no authorization headers are provided the user is redirected to a login page. Obviously this is not a valid GetCapabilities document, hence the various kinds of errors (invalid XML and missing Title string).
- 主要语言
- Python
- 星标
- 92
- 派生
- 76
- 平均合并
- 7 小时 21 分钟
- 30 天内合并 PR
- 3
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
geopython/GeoHealthCheck 的其他 Issue
-
Data import未关闭question
难度 4/5 3-5 天 新手友好度 38/100
geopython/GeoHealthCheck#522 · 1 条评论 ·
-
FTP Probe未关闭enhancement
难度 4/5 3-5 天 新手友好度 48/100
geopython/GeoHealthCheck#520 ·
-
bug
难度 3/5 1-2 天 新手友好度 55/100
geopython/GeoHealthCheck#517 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 45/100
geopython/GeoHealthCheck#483 · 1 条评论 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
geopython/GeoHealthCheck#472 ·
查看 geopython/GeoHealthCheck 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 78/100
uniswap-python/uniswap-python#487 ·
-
[Bug]: agent_final_response still returns the abandoned branch's answer after navigate moves HEAD back可能已有人在做 @enyst 今天认领。 未关闭bug priority:low ready-for-dev
难度 2/5 1-3 小时 新手友好度 72/100
OpenHands/software-agent-sdk#5822 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
-
area: server enhancement good first issue
难度 2/5 1-3 小时 新手友好度 82/100
scs0209/laya-guard#52 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复