Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Testing a new resource with basic auth gives errors

オープン
#374 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

リソースのテストのエントリーポイントとして traceback が特定している sniff_test_resource のある GeoHealthCheck/healthcheck.py から始めます。未保存のリソースの basic-auth 認証情報とタイトルが OWS WMS リクエストに到達するまでの流れを追い、その経路を保存済みリソースのテスト時の経路と比較します。最初の Test アクションが指定された認証情報を使用し、認証されていないログインレスポンスを追従せずにリソースのタイトルを表示すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

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分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

geopython/GeoHealthCheck のほかの issue

geopython/GeoHealthCheck の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。