httpx.ConnectError: EOF occurred in violation of protocol (_ssl.c:1131)

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
python
領域
api, networking

調査の方向性

httpx.get エントリポイントから始め、httpcore の同期接続、プロキシ、TLS 処理を通る報告された経路を追跡します。示されている Python 3.8 と httpx 0.24.1 のセットアップでリクエストを再現し、そのうえで失敗が環境固有ではなくプロジェクト内で再現可能かどうかを判断します。完了とするには、確認済みの原因とテストまたは文書化された解決策が必要ですが、issue では現時点でそのどちらも定義されていません。

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

説明

Originally opened by @jekoie on 2023-07-22 09:47:26 in encode/httpx

I try to use bellow code run httpx, but it run as error?

import httpx
r = httpx.get('https://httpbin.org/get')
print(r)

** The Error**

PS E:\test> & C:/Users/jekoi/AppData/Local/Programs/Python/Python38/python.exe e:/test/t6.py
Traceback (most recent call last):
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_exceptions.py", line 10, in map_exceptions
    yield
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_backends\sync.py", line 62, in start_tls
    raise exc
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_backends\sync.py", line 57, in start_tls
    sock = ssl_context.wrap_socket(
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1131)

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

Traceback (most recent call last):
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions
    yield
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_transports\default.py", line 218, in handle_request
    resp = self._pool.handle_request(req)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection_pool.py", line 262, in handle_request
    raise exc
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection_pool.py", line 245, in handle_request
    response = connection.handle_request(request)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\http_proxy.py", line 271, in handle_request
    connect_response = self._connection.handle_request(
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection.py", line 92, in handle_request
    raise exc
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection.py", line 69, in handle_request
    stream = self._connect(request)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection.py", line 149, in _connect
    stream = stream.start_tls(**kwargs)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_backends\sync.py", line 62, in start_tls
    raise exc
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: EOF occurred in violation of protocol (_ssl.c:1131)

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

Traceback (most recent call last):
  File "e:/test/t6.py", line 3, in <module>
    r = httpx.get('https://httpbin.org/get')
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_api.py", line 189, in get
    return request(
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 814, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 901, in send
    response = self._send_handling_auth(
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 929, in _send_handling_auth
    response = self._send_handling_redirects(
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 966, in _send_handling_redirects
    response = self._send_single_request(request)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 1002, in _send_single_request
    response = transport.handle_request(request)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_transports\default.py", line 218, in handle_request
    resp = self._pool.handle_request(req)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\jekoi\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: EOF occurred in violation of protocol (_ssl.c:1131)
PS E:\test>
PS E:\test> pip show httpx
Name: httpx
Version: 0.24.1
Summary: The next generation HTTP client.
Home-page:
Author:
Author-email: Tom Christie <[email protected]>
License:
Location: c:\users\jekoi\appdata\local\programs\python\python38\lib\site-packages
Requires: certifi, httpcore, idna, sniffio
Required-by:
PS E:\test> 
主要言語
Python
スター
1.6k
フォーク
103
平均マージ
1日 19時間
マージ済み PR(30日)
25

環境構築

はじめの一歩

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

pydantic/httpx2 のほかの issue

pydantic/httpx2 の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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