Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

An example of http2 based on ssl #369

@guoxiaolu

Description

@guoxiaolu

`from hyper import HTTP20Connection, tls
from hyper.compat import ssl

context = tls.init_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

conn = HTTP20Connection('https://127.0.0.1', 5000, ssl_context=context)
conn.request('GET', '/')
resp = conn.get_response()

print(resp.read())`

I want to test a http2 based on tls, and write an example, but it returns error like this:
Traceback (most recent call last): File "hyper_test.py", line 13, in <module> conn.request('POST', '/') File "/home/lavector/http2/hyper/hyper/http20/connection.py", line 274, in request self.endheaders(message_body=body, final=True, stream_id=stream_id) File "/home/lavector/http2/hyper/hyper/http20/connection.py", line 560, in endheaders self.connect() File "/home/lavector/http2/hyper/hyper/http20/connection.py", line 374, in connect timeout=connect_timeout) File "/usr/lib/python2.7/socket.py", line 557, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno -2] Name or service not known

can you give me some suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions