fedora-infra / anitya

A cross-distribution upstream release monitoring project
https://release-monitoring.org
GNU General Public License v2.0
237 stars 104 forks source link

Unable to access certain URLs for custom backend #1784

Closed Zopolis4 closed 1 month ago

Zopolis4 commented 1 month ago

image

Attempting to follow the process as set out in the documentation like so,

url = 'http://www.researchandtechnology.net/bcif/index.php'

import requests
import re
text = requests.get(url).text
re.findall('bcif_sources_(.*?)_beta\.zip', text)
Python 3.11.9 (main, Apr 10 2024, 13:16:36) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> url = 'http://www.researchandtechnology.net/bcif/index.php'
>>> 
>>> import requests
>>> import re
>>> text = requests.get(url).text
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 716, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 468, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 463, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1395, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 325, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 294, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 800, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/six.py", line 718, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 716, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 468, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 463, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1395, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 325, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 294, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

Presumably this is the same error happening when Anitya tries to access the URL.

Zlopez commented 1 month ago

There are few issues I can see here.

1) Because the page is just http://, you need to check the Use insecure connection when creating project to even be able to access it, this is why the requests example failed for you.

2) I assume the issue is in PHP rendering of the page. The requests doesn't do a rendering of PHP file. I tried it with curl http://www.researchandtechnology.net/bcif/index.php and it returns curl: (52) Empty reply from server. This is why even with Use insecure connection it doesn't match any regex you set (I tried that).

The best option here is to find other place where you can obtain the versions than this page as it's really strange and it's still HTTP only. I assume the project didn't had any update in last 10 years, at least I can't find anything else about it.

Zopolis4 commented 1 month ago

My browser can access the page fine, which is why I'm a little confused.

Because the page is just http://, you need to check the Use insecure connection when creating project to even be able to access it, this is why the requests example failed for you.

The documentation misled me-- still doesn't work with insecure connection enabled image

The best option here is to find other place where you can obtain the versions than this page as it's really strange and it's still HTTP only.

I looked, couldn't find anything else. Maybe some sort of proxy site that will put this into regular text? Doesn't feel great...

Zlopez commented 1 month ago

It seems that the tooltip is wrong, it's meant for HTTP as well.

My browser shows the page correctly as well, but browsers have plenty of interpreters in them.

I can't do much about this on Anitya side. I'm not sure if the project is even a good candidate for tracking as I don't see any history of versions and it seems that the last version released is few years old.