- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.5k
          p3-http: finish wasi:http@0.3 implementation
          #11636
        
          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
          
     Merged
      
      
            rvolosatovs
  merged 18 commits into
  bytecodealliance:main
from
rvolosatovs:refactor/wasip3-http-trappable
  
      
      
   
  Sep 9, 2025 
      
    
                
     Merged
            
            
  
    p3-http: finish wasi:http@0.3 implementation
  
  #11636
              
                    rvolosatovs
  merged 18 commits into
  bytecodealliance:main
from
rvolosatovs:refactor/wasip3-http-trappable
  
      
      
   
  Sep 9, 2025 
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    wasi:http@0.3 implementation part 2
      ee60e0f    to
    ba6d2ad      
    Compare
  
    wasi:http@0.3 implementation part 2wasi:http@0.3 implementation
      | @alexcrichton this is ready for review. I'll address the rest along with the spawned task tracking in yet another follow-up tomorrow (or push here if it's not merged by that time yet) | 
              
                    alexcrichton
  
              
              approved these changes
              
                  
                    Sep 8, 2025 
                  
              
              
            
            
        
          
                crates/test-programs/src/bin/p3_http_outbound_request_content_length.rs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
This is something we've been doing in wasip3, but I forgot to port this over Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Most importantly this avoids a race condition between `content-length` error observed by `GuestBody` and hyper I/O driver Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
ded256d    to
    4ef40a8      
    Compare
  
    Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
    
  alexcrichton 
      pushed a commit
        to alexcrichton/wasmtime
      that referenced
      this pull request
    
      Sep 9, 2025 
    
    
      
  
    
      
    
  
* refactor(p3-http): use trappable errors Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * feat(p3-http): implement `content-length` handling Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): remove a few resource utilities Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * remove unused test import Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix(p3-http): close stream handles on drop Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * test(p3-http): stream responses back This is something we've been doing in wasip3, but I forgot to port this over Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * doc(p3-http): add missing docs, internalize more, simplify Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): extract `Body::consume` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): clean-up `content-length` error reporting Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): drop elided lifetime Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix(p3-http): avoid guest body deadlock hazard Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): add more docs, clean-up Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * doc(p3-http): add more docs Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix(p3-http): rework result future handling Most importantly this avoids a race condition between `content-length` error observed by `GuestBody` and hyper I/O driver Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * add new imports after rebase Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * clean-up `poll_consume` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * assert content-length `handle` results Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * relax `content_length` test `handle` assert Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> --------- Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
    
  alexcrichton 
      added a commit
      that referenced
      this pull request
    
      Sep 9, 2025 
    
    
      
  
    
      
    
  
* support non-async `{stream,future}.cancel-{read,write}` (#11625)
* support non-async `{stream,future}.cancel-{read,write}`
During my earlier stream API refactoring, I had forgotten to support or test
synchronous cancellation; this commit does both.  In the process, I realized the
future API ought to be updated to support blocking cancellation just like the
stream API, so I made that change as well.
This also adds `{Source,Destination}::reborrow` functions, allowing instances of
those types to be reborrowed, such that they may be passed as parameters but
also used again.
Note that I had to move some functions from `impl ConcurrentState` to `impl
Instance` in order to access the store and suspend the current fiber when
synchronously cancelling.
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* reduce code duplication
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
---------
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* support and test synchronous `{stream,future}.cancel-{read,write}` (#11645)
* support and test synchronous `{stream,future}.cancel-{read,write}`
Previously, we only supported async calls to those intrinsics; now we support
blocking, synchronous calls as well.
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* update future-read.wast test
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
---------
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* p3-http: finish `wasi:http@0.3` implementation (#11636)
* refactor(p3-http): use trappable errors
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* feat(p3-http): implement `content-length` handling
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* refactor(p3-http): remove a few resource utilities
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* remove unused test import
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* fix(p3-http): close stream handles on drop
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* test(p3-http): stream responses back
This is something we've been doing in wasip3, but I forgot to port this
over
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* doc(p3-http): add missing docs, internalize more, simplify
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* refactor(p3-http): extract `Body::consume`
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* refactor(p3-http): clean-up `content-length` error reporting
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* refactor(p3-http): drop elided lifetime
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* fix(p3-http): avoid guest body deadlock hazard
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* refactor(p3-http): add more docs, clean-up
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* doc(p3-http): add more docs
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* fix(p3-http): rework result future handling
Most importantly this avoids a race condition between `content-length` error observed by `GuestBody`
and hyper I/O driver
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* add new imports after rebase
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* clean-up `poll_consume`
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* assert content-length `handle` results
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* relax `content_length` test `handle` assert
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
---------
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* p3-http: implementation follow-up (#11649)
* p3: refactor future producers/consumers
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* p3-http: tie lifetime of the spawned task to the bodies
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* p3-http: improve docs
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
---------
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* Ignore a wasip3 http test temporarily (#11657)
Filed #11656 to track the eventual resolution.
* don't delete sync-lowered subtasks unless they've exited (#11655)
Previously, we were unconditionally deleting the callee subtask once it returned
a value to a sync-lowered call, but that's only appropriate if the subtask has
exited.  Otherwise, it needs to keep running and only be deleted once it
actually exits.
Thanks to Luke for the `sync-streams.wast` test that uncovered this, which I've
copied from the `component-model` repo.
This also makes a couple of debug logging tweaks that proved useful while
investigating the above issue.
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
---------
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Joel Dice <joel.dice@fermyon.com>
Co-authored-by: Roman Volosatovs <rvolosatovs@users.noreply.github.com>
    
    
  bongjunj 
      pushed a commit
        to prosyslab/wasmtime
      that referenced
      this pull request
    
      Oct 20, 2025 
    
    
      
  
    
      
    
  
* refactor(p3-http): use trappable errors Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * feat(p3-http): implement `content-length` handling Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): remove a few resource utilities Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * remove unused test import Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix(p3-http): close stream handles on drop Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * test(p3-http): stream responses back This is something we've been doing in wasip3, but I forgot to port this over Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * doc(p3-http): add missing docs, internalize more, simplify Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): extract `Body::consume` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): clean-up `content-length` error reporting Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): drop elided lifetime Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix(p3-http): avoid guest body deadlock hazard Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor(p3-http): add more docs, clean-up Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * doc(p3-http): add more docs Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix(p3-http): rework result future handling Most importantly this avoids a race condition between `content-length` error observed by `GuestBody` and hyper I/O driver Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * add new imports after rebase Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * clean-up `poll_consume` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * assert content-length `handle` results Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * relax `content_length` test `handle` assert Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> --------- Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Follow-up to #11440, refs #11632
closes #11631
This makes all the existing p3 test cases pass