Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up the formatting of HTTP/2 requests #1860

Merged
merged 2 commits into from Sep 14, 2021

Conversation

tomchristie
Copy link
Member

HTTP/2 requests displayed in the console should:

  • Use "HTTP/2" in the version.
  • Display lowercase headers.

As it happens the HTTP/2 displays in the console are not completely ideal, because we print them in the request event hook, but we don't actually know at that point if HTTP/2 will be successfully negotiated or not. Still it's close enough to display it as an HTTP/2 request, and have the response indicate which version actually got used.

Sometime further down the line we'll want to address this with some additional information for verbose displays, eg...

* Connected to www.example.com (1.2.3.4) on port 443. (HTTP/2 Negotiated)
GET / HTTP/2
host: www.example.com
accept: */*
accept-encoding: gzip, deflate, br
connection: keep-alive
user-agent: python-httpx/1.0.0.beta0

HTTP/2 200 OK
content-encoding: gzip
accept-ranges: bytes
age: 425769
cache-control: max-age=604800
content-type: text/html; charset=UTF-8
date: Tue, 14 Sep 2021 12:09:17 GMT
etag: "3147526947+gzip"
expires: Tue, 21 Sep 2021 12:09:17 GMT
last-modified: Thu, 17 Oct 2019 07:18:26 GMT
server: ECS (nyb/1D0F)
vary: Accept-Encoding
x-cache: HIT
content-length: 648

<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", 
"Helvetica Neue", Helvetica, Arial, sans-serif;
        
    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 2em;
        background-color: #fdfdff;
        border-radius: 0.5em;
        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        div {
            margin: 0 auto;
            width: auto;
        }
    }
    </style>    
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

But that's an issue for another day.

@tomchristie tomchristie added the user-experience Ensuring that users have a good experience using the library label Sep 14, 2021
@tomchristie tomchristie merged commit e1abaf1 into master Sep 14, 2021
@tomchristie tomchristie deleted the tidy-up-http2-request-formatting branch September 14, 2021 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-experience Ensuring that users have a good experience using the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant