Testing a new resource with basic auth gives errors
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- api, authentication, backend
Direzione di ricerca
Inizia in GeoHealthCheck/healthcheck.py, in sniff_test_resource, che il traceback identifica come punto di ingresso per il test della risorsa. Segui il percorso con cui le credenziali di basic-auth e il titolo della risorsa non salvata arrivano alla richiesta OWS WMS, quindi confrontalo con il test di una risorsa salvata. Il lavoro è completato quando l’azione Test iniziale usa le credenziali fornite e visualizza il titolo della risorsa senza seguire la risposta di accesso non autenticata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- Python
- Stelle
- 92
- Fork
- 76
- Merge medio
- 7h 21m
- PR unite (30g)
- 3
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di geopython/GeoHealthCheck
-
Data importApertaquestion
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
geopython/GeoHealthCheck#522 · 1 commento ·
-
FTP ProbeApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
geopython/GeoHealthCheck#520 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
geopython/GeoHealthCheck#517 ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
geopython/GeoHealthCheck#483 · 1 commento ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
geopython/GeoHealthCheck#472 ·