bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
828 stars 162 forks source link

[Bug]: reponse body is unexpected EOF,but when open debug, the log response body payload: is not null and status=200 #136

Open donque opened 1 week ago

donque commented 1 week ago

TLS client version

v1.7.8

System information

windows 11 amd64

Issue description

requested https://targetur.com : status 200 response body payload:(ps gzip compress) �ŜYsǕ���+H���H�k��S�u�~��O���B0@P����wr��f����QD��r���7of��׫�gϞ�^_���z��o��{���b�|?����(�og?�Ӧ���O͏�f�ݏU��w�~�ô��������7���Ӌ�{��W�_\���vx�|�}�����vt�������fy�]�o���A?�����kM��������"6����d<���ǣ���b� �������Y-u������D����!vu�_��_]����4�������v��W˫_�߶�\n�.������M�Ճ� ��/�׿��[������,g�%&�:����ɪѼ�u�yv��7�o��&�ɮ�.g�a������-�~��T?_O��W���{�O��惇�,;C�͐���JÛ�H4�)���)j�2T's}o��z��u��I�շ��M$q�6�Z�S��"��.Ν!�([vQ���D��{� 7�t��5��XJj�����F�O���J"Oc���U�Z�yYĎ�$�ݭo\m2X�@%-��_ֈ�w�����ep���6�+$>c�e�j@�b(��e�4%i��X��7�mxHj���8������"� ՔJ�L���Z��� ��g���i����мNR�7��#� I�"��bm�"$ �6<G?�zN�N�wF�"f��h�1O�H���Dv����sCL��r�^)�2?�!?֌�3W�0�S?�׸4ߎS�NU�m� ��+�d0�1���#M���X�Na�#��pn�v�Mp�9���H�� ��Z���LwP�T��I+�HV�{,�����7ʡd��$�TS�KCQl�_�[F�!�?������!+���ȥP7����^���Ô ŋ���=ey�TU!G�< �G��KS%(���L*.��O��A�v&�i��5�Q9RO�M�yJ�6En�'�tʧ"�C}����qX���h��hiIؕN8'�e'��>..�Ԑzg)��@ � �L�H�5)���z[XB9�Z$a��Y�]��Tw�U��J����i�s|3nit�KZ~���;S�}�8�)n�S���<��P���8YA"ZX��[m�Hf!��oMK�X�Eږf��� ���!S&���MQPJP���3��g�F!$ �������I�[�R�wh���f��.�R�lN8I��%Y���e*���4C%s8���xùE���W{V�i�AD V��� �Hj'L�s!����$.��� P�C�%5�����&�h���)���J��?��N'�I.#��]}w���S����uא�jo���+Q ��MtK?� %CG�q6t��<�0Ā�=]dn��V��>.W[X�W!��wS�Cy�����][�!����߉ Q�����E��2�̒��a�.Q�^���9Ѓ����W�[N���$h�Y�z>ݍ�W1���&ѱY�Eo��= �����l;|�(��Д q☈V��'-J;R/�E;�/'C�����j���'-�,�j�s��↓�!�A٤<q��|�$Π�?t�� +��2�L�� c�A3h�=��,����:��O�I��x��jl[mg�x˯f2�6�mg�rb�5���ۿ޽���X-g�nL r$A��L+��Y��U���w��h̶5�x6)� ��gG�Uvey���c8��S���lێ��[�bU�v�y�i��-7�c�&%�7�yY��$��a����}z�(�F7�۫7��(΁�d��d���X/�bg���� ���{ׅ��l��2 ��gh9��,��y��rj����%tI��� X����77 �0X����z,�ħN��������+��p�����G?=~AL��_z�"�l3�����K �?%�妙��[1nv�ܱ��Lgs#!4��4Ky=4&��F� ���y\���u��l��������/^��8י8�B�sA�d����f�;=�n:Y�^����@,�zSL}@ߚ�!�)x�UJY�i��VZK�S�rh<sI�cy�t2���}��f�����~�ӮM��;�����]�bx�d�bM�O<dn簸�����-�I+����BGq�ABM��L���`��r�4���+�%�L6�_Q�/Q���Zr����]��[.'M���q��x��|���8V$�9p�Sl����y�x�|׈#^���|�B2�7�>I�|��%��4�E��TO�6�i����nv�\��O�>�L���X��E��%PlQh%�1f,�uƕN�)Yb3@�� 9�L�����ɠD,���b�Y3W ���X��Pbʎ��Lԗ �S�8�����k�$��}p+�}"�>:Rb���!���i�D�z����K��������I��hx��qx�f��͞�Ҏj��� �O����/>T������C$��U���TBc���Ʋ�a��ށ�'}頲����p��{Gȴ9q��4��ɨۮ'�U�����qa:r ��(!���Gx�p Wv��b9ލk�U�����vq�>�bIG4wSr��ڂ�ȓ�l�h[G[�LJ��?��/���0c�G�&���1f������L�U�5C�0K��P����5,&�a�rg[���oI�ʡh����\b���.q��d���.uY��鬇�z\,w�o�r��غO�������.k���k��&�],�.V^P��k����\�[x1�P��(W��D1��{�Py��X8�����x�T6�#� �#?n�Z&����#�����Y+I������ (�[#ԀAaA�����=�ŚBvC���n��d��y��+�8�%o�op���B}�`V��(���=��d~�y�d�|;� �FJQ 簡0v���D�{Vh����f��U}�Gs��N���z[&{�'��1X���}�]��#������љ�b(�vu�+i�-� ��u���>0�Ѝ��:�e��Lܡ��ͮ$$�����yZIz�s��)����5 �J�d�X����f/�{��4��&'u�6�-zYwnv�$���4����c>'y��9C��S��5�rc�>�S%яL�{�4i7Э�Ճe�O��2�t�i�S��N�6��y0Ai��w���NYm� ` ��7���>�X��G�Ŵ�h-�<|�ݏ҄�1X>ɓ�f� J=��qc+����A����E*�f���&��]\�m��C���=E��tS.p��ݳ��^Hۄy8��� L����l3kt��Y���|׬��i��oNj,���1tGa��Q�&ض�� ���ɜg {�J�)��-���������؜9�>���hα3��:��I�=�G��' �vR)˒�X8�5u>ZJc[��#�� 7t=¤����]&�P+zn8��ɴ�����C �P��XgϥWϫ�~���=5��I�I�֝y�ޓru����gml��Ƿ�盋�H�&Á�<xx��R��8�� p��/9z�s2���z�))��Z�X�8�;kUhic���tu_]y[m��$�����AP~iCQ�8�mOe�!�?(���1�}T| ��|[��� �"���x�5��94'�p�^[� q(�u�%b�iE���97�V��y�wPA9� �9>�_�ƀb�? � -t�n-����S�<4��4��vF3��/c�m�%cJ��T�8����r�Y�8)5�d�l�"�/��]���"����7 eu�QRi��Va%��ҍ겘N�p��?y�n���3 y��[���a"��<=�t����7��H��3����[=D��c1���%�ǑZ�8�m�Ô��@ڻ����Fc���E-�[Z\O�͊i��J�%1�u<�tq�����U���~c�fYP|���倘!���� �C��\�Mm�/�0U�l���x3���/s�]�Zc���Sc��ώzUAF�.O�x��.[[��}�m�^̄B��e�FK��p���Gr��/�—',j�����>�1dEU�3d%��;��t��͹�B�wOv몗R j�M���k,�Ғ����1�s��@�f��1A 4���t|{u�������O�ֿ:�u=�T��r��@;̉���7�]��J����acP���^$�9;���˥n�P�ɓrF��gZ�[W��T�Q����,�W�֑�����������k�6��J]��ZzS�J���oź�FR�7�B|����x�Q�o�NG�K~d���<�f][�����)���^��;u���e��/�� �X���$���Bi9�͇�rzϘ���MW�/�W!���N���k*$hR렝�aYRe{���܎{5������ؤ��Yv<��,�6�~�f����oÇ��r�������x�L�h9���N���<�=d!y��Ʌ��ZZ��+ȑk�p7��ٳ���mW�pØ� ��� �?]�i]��i����N�t�=���ȅ4 ��H � ڙ}���~ ��5�z��k���O8�B�0p�i�eO��rU襤����@|��Z�rS�z�-%�UՌ�._�p ;�'Ldz�fn���9R��q��5 B�N5Xa/Y�F����7�8�����l]Y��l��T�%�`�;��d�Z.۷j����)�P6��1���t��a�8��Uއ�e)���^� �!�9i���m�jy�1Rh���B�Q����G9ѡk~���TcK��d'O�w>���r!΋���4�t�q걈ua�����ǚ��%U��WJ}T"��6���� ��y�W�٩��)�f:ΎL8C�H�ũ���oώҦ��� T}1�I�ӄ�u�,��E�ANl}:-��\��wʖ��ó��S�:H>if�-%��CN`��}x&Ҥ�3N�*�E������[OvF�j��[� ��B����_x���ſK��

raw response bytes received over wire: 282 (0 kb) get cookies for url: https://targetur.com dump the response object is : {"body":"unexpected EOF", "id":"188d73fd-460b-4b5a-98e8-e761eaae7f5d", "sessionId":"{64A23FFE-AECD-4DC9-B231-A0CE5B25A035}", "status":0, ... }

Steps to reproduce / Code Sample

var request_payload = { "sessionId": this._session_id, "followRedirects": this.allow_redirects, "forceHttp1": this.force_http1, "withDebug": this.debug, "catchPanics": this.catch_panics, "headers": req_headers.raw_items(), "headerOrder": this.header_order, "insecureSkipVerify": this.insecure_skip_verify, "isByteRequest": is_byte_request, "additionalDecode": this.additional_decode, "proxyUrl": this.proxy, "requestUrl": url, "requestMethod": method, "requestBody": request_body, "requestCookies": request_cookies, "timeoutSeconds": timeout_seconds, "isByteResponse":this.isByteResponse, "transportOptions":{"disableKeepAlives":true,"DisableCompression":true}, } if(this.certificate_pinning){ request_payload["certificatePinningHosts"] = this.certificate_pinning } if(!this.client_identifier){ request_payload["customTlsClient"] = this.tls_client; }else{ request_payload["tlsClientIdentifier"] = this.client_identifier request_payload["withRandomTLSExtensionOrder"] = this.random_tls_extension_order }

    var response = request(..web.json.stringify(request_payload));
    var response_string = ..raw.tostring(response);
    var response_object = ..web.json.tryParse(response_string);
    this.lastStatusCode = response_object.status;
    ..console.log("-----------========================----------------------")
    ..console.dumpJson(request_payload);
    ..console.dumpJson(response_object);
    freeMemory(response_object['id']);
    if(response_object["status"] == 0){
        return null, response_object["body"];
    }
    this.update_cookies(response_object["headers"], response_object["cookies"]);
    return this.build_response(request_payload, response_object);
wy850813 commented 1 week ago

System default encoding issue