Project

General

Profile

Actions

Optimization #7317

open

HTTP2 push

Added by Philippe Antoine 2 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Target version:
Effort:
Difficulty:
Label:

Description

I wonder how we should handle this for real.
Here is pcap I crafted with a golang server

package main

import (
    "fmt" 
    "golang.org/x/net/http2" 
    "golang.org/x/net/http2/h2c" 
    "net/http" 
)

func main() {
    h2s := &http2.Server{}

    handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        fmt.Printf("lol %s\n", r.RequestURI)
        if r.RequestURI == "/flag" {
            pusher, ok := w.(http.Pusher)
            fmt.Printf("lola %v\n", ok)
            if ok {
                err2 := pusher.Push("/toto", nil)
                fmt.Printf("lola %s\n", err2)
            }
        }
        http.ServeFile(w, r, "flag.txt")
    })

    server := &http.Server{
        Addr:    "127.0.0.1:8080",
        Handler: h2c.NewHandler(handler, h2s),
    }

    fmt.Printf("Listening [0.0.0.0:8080]...\n")
    err := server.ListenAndServe()
    fmt.Printf("lol %s", err)
}

and a client with python hyper

from hyper import HTTP20Connection
c = HTTP20Connection('127.0.0.1', port=8080, enable_push=True)
c.request('GET', '/flag')
resp = c.get_response()
for push in c.get_pushes():
  print(push.path)


Files

h2push.pcap (2.46 KB) h2push.pcap Philippe Antoine, 10/09/2024 06:54 PM
Actions #1

Updated by Philippe Antoine 2 months ago

Questions are like is it right to log the HTTP method and URI from the server (and not from the client as usual)
Do we detect them ok ?

Also looks like we should handle HTTP2StateReserved when we get HTTP2_FLAG_HEADER_EOS

Actions

Also available in: Atom PDF