Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1832

HTTP/2 Push works only for first request sent over HTTP/2 connection

XMLWordPrintable

    • Hide

      I've create reproducer project based on undertow's http2 example.

      1. Clone and build https://github.com/alex-bel/undertow-http2push-bug
      2. Run http2push.Http2Server class, it will start undertow with https listener on port 8443
      3. Open new empty (about:blank) tab in Chrome
      4. Open Devtools for this tab
      5. In the Devtools window go to Network tab and enable "Preserve log" checkbox
      6. In Chrome tab navigate to https://localhost:8443 
      7. Chrome will complain about invalid certificate, click Advanced and "proceed to localhost (unsafe)"
      8. Test page will appear in Chrome, Devtools window should look like this
      9. Note the "Push" label in the "Initiator" column; this means that image was pushed by the server.
      10. Reload the page ASAP (to make sure that Chrome reuses old connection)
      11. 2 more requests will appear in the Devtools window
      12. Not that image was not pushed when the page is reloaded. I've added random 'key' query param to make sure that browser won't cache the image. Expected behavior is that image should be pushed after page reload
      Show
      I've create reproducer project based on undertow's http2 example. Clone and build https://github.com/alex-bel/undertow-http2push-bug Run http2push.Http2Server class, it will start undertow with https listener on port 8443 Open new empty (about:blank) tab in Chrome Open Devtools for this tab In the Devtools window go to Network tab and enable "Preserve log" checkbox In Chrome tab navigate to https://localhost:8443   Chrome will complain about invalid certificate, click Advanced and "proceed to localhost (unsafe)" Test page will appear in Chrome, Devtools window should look like this Note the "Push" label in the "Initiator" column; this means that image was pushed by the server. Reload the page ASAP (to make sure that Chrome reuses old connection) 2 more requests will appear in the Devtools window Not that image was not pushed when the page is reloaded. I've added random 'key' query param to make sure that browser won't cache the image. Expected behavior is that image should be pushed after page reload
    • Undefined

      I was playing with HTTP/2 Push feature using Undertow as server and I found out that Undertow sends Pushes only for first request within HTTP/2 connection. 

      I've debugged undertow a little bit, seems like the problem is in frame ordering algorithm in  Http2FramePriority class.

      The

      newFrame.getChannel().isClient() 

      part of the 

      (newFrame.getChannel().isClient() && newFrame instanceof Http2HeadersStreamSinkChannel)

      condition prevents execution of the code that increments nextId when last frame is added.

      Therefore all Push frames on second and later requests (having stream id of 3 and larger) are added into heldFrames queue in the AbstractFramedChannel and never pulled from that queue.

       

        1. image-2021-01-16-19-32-59-815.png
          44 kB
          Alex Beliaev
        2. image-2021-01-16-19-39-40-735.png
          94 kB
          Alex Beliaev
        3. image-2021-03-19-23-37-23-107.png
          897 kB
          Alex Beliaev

              rhn-cservice-bbaranow Bartosz Baranowski
              alex.bel.izh Alex Beliaev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: