tork-a / roswww

Tiny web server for ROS (forked from https://github.com/jihoonl/roswww)
Other
36 stars 25 forks source link

[roswww] fix basic authentication for python3 #59

Open knorth55 opened 1 year ago

knorth55 commented 1 year ago

this PR fix basic authentication for python3.

knorth55 commented 1 year ago

without this PR, the following error occurs.

HTTPServerRequest(protocol='http', host='pr1040s.jsk.imi.i.u-tokyo.ac.jp:8000', method='GET', uri='/rwt_teleop/', version='HTTP/1.1', remote_ip='133.11.216.212')
Traceback (most recent call last):
  File "/usr/lib/python3.8/base64.py", line 510, in _input_type_check
    m = memoryview(s)
TypeError: memoryview: a bytes-like object is required, not 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/home/applications/ros/noetic/src/tork-a/roswww/src/roswww/roswww_server.py", line 67, in new_f
    auth_decoded = base64.decodestring(auth_header.split(' ', 1)[1])
  File "/usr/lib/python3.8/base64.py", line 554, in decodestring
    return decodebytes(s)
  File "/usr/lib/python3.8/base64.py", line 545, in decodebytes
    _input_type_check(s)
  File "/usr/lib/python3.8/base64.py", line 513, in _input_type_check
    raise TypeError(msg) from err
TypeError: expected bytes-like object, not str

this PR is running on Noetic + Pr2.