a76yyyy / qd

基于 binux/qiandao和AragonSnow/qiandao 进行修改,添加完善功能,将生产环境切换至python3.10
MIT License
104 stars 25 forks source link

[Bug]框架{{unicode(a)}}参数过滤器BUG. #15

Closed wjf0214 closed 3 years ago

wjf0214 commented 3 years ago

Describe the bug 框架{{unicode(a)}}参数过滤器BUG.

To Reproduce 当res为变量的时候。{{unicode(res)}}没有转换。把res直接输出了。 但是我把res换着对应的字符串值就可以。

Expected behavior 当{{unicode(res)}}方式使用的时候,应该正常转换输出。而不是输出res原值。

Screenshots 6)I`V8C7H}A910$0X }J~X

Q`HR`ID UE%Z79 6VT9EBYH

Version Docker镜像20210917版本。

a76yyyy commented 3 years ago

已修复,请使用docker内源码更新方式更新框架并重启容器

wjf0214 commented 3 years ago

已修复,请使用docker内源码更新方式更新框架并重启容器

更新完后报错。错误信息为:

[E 210928 18:00:25 web:1789] Uncaught exception POST /har/test (xxx.xxx.xxx.xxx)

    HTTPServerRequest(protocol='http', host='xxxx', method='POST', uri='/har/test', version='HTTP/1.0', remote_ip='xxx.xxx.xxx.xxx')

    Traceback (most recent call last):

      File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute

        result = await result

      File "/usr/src/app/web/handlers/har.py", line 74, in post

        ret = await gen.convert_yielded(self.fetcher.fetch(data))

      File "/usr/src/app/libs/fetcher.py", line 465, in fetch

        rule, env, response = await gen.convert_yielded(self.build_response(obj, proxy, CURL_ENCODING, CURL_CONTENT_LENGTH))

      File "/usr/src/app/libs/fetcher.py", line 422, in build_response

        response =  await gen.convert_yielded(self.client.fetch(req))

      File "/usr/local/lib/python3.8/site-packages/tornado/curl_httpclient.py", line 234, in _process_queue

        self._curl_setup_request(

      File "/usr/local/lib/python3.8/site-packages/tornado/curl_httpclient.py", line 333, in _curl_setup_request

        curl.setopt(pycurl.URL, native_str(request.url))

    UnicodeEncodeError: 'ascii' codec can't encode characters in position 106-122: ordinal not in range(128)

[E 210928 18:00:25 web:1789] Uncaught exception POST /har/test (xxx.xxx.xxx.xxx)

    HTTPServerRequest(protocol='http', host='xxx', method='POST', uri='/har/test', version='HTTP/1.0', remote_ip='xxx.xxx.xxx.xxx')

    Traceback (most recent call last):

      File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute

        result = await result

      File "/usr/src/app/web/handlers/har.py", line 74, in post

        ret = await gen.convert_yielded(self.fetcher.fetch(data))

      File "/usr/src/app/libs/fetcher.py", line 465, in fetch

        rule, env, response = await gen.convert_yielded(self.build_response(obj, proxy, CURL_ENCODING, CURL_CONTENT_LENGTH))

      File "/usr/src/app/libs/fetcher.py", line 422, in build_response

        response =  await gen.convert_yielded(self.client.fetch(req))

      File "/usr/local/lib/python3.8/site-packages/tornado/curl_httpclient.py", line 234, in _process_queue

        self._curl_setup_request(

      File "/usr/local/lib/python3.8/site-packages/tornado/curl_httpclient.py", line 333, in _curl_setup_request

        curl.setopt(pycurl.URL, native_str(request.url))
a76yyyy commented 3 years ago

bug修复后请确保url内容的中文被urlencode转码

right image error1 image error2 image

wjf0214 commented 3 years ago

这样之后好了!