class
Amber::Pipe::Pipeline
- Amber::Pipe::Pipeline
- Amber::Pipe::Base
- Reference
- Object
Overview
This class picks the correct pipeline based on the request and executes it.
Defined in:
amber/pipes/pipeline.crConstructors
Class Method Summary
-
.body_inflated_by_server?(request : HTTP::Request) : Bool
Returns
truewhenHTTP::Serverreplaced the body of request with a decompressing reader, which Crystal before 1.21.1 does forgzipanddeflatebodies with no limit on the inflated size (GHSA-jfq5-c3x6-w7jj). -
.content_encoded?(request : HTTP::Request) : Bool
Returns
truewhen request carries a compressed body, in either of the two forms a Crystal compiler can hand to Amber:
Instance Method Summary
-
#build(valve : Symbol, &)
Connects pipes to a pipeline to process requests
- #build_pipeline(pipes, last_pipe : HTTP::Handler | HTTP::Server::Context -> )
-
#call(context : HTTP::Server::Context)
Execution of this handler.
- #pipeline : Hash(Symbol, Array(HTTP::Handler))
- #plug(pipe : HTTP::Handler)
- #prepare_pipelines
- #valve : Symbol
Instance methods inherited from class Amber::Pipe::Base
call(context : HTTP::Server::Context)
call
Constructor Detail
Class Method Detail
Returns true when HTTP::Server replaced the body of request with a
decompressing reader, which Crystal before 1.21.1 does for gzip and
deflate bodies with no limit on the inflated size
(GHSA-jfq5-c3x6-w7jj). The reader inflates only as it is read, so a
request refused at this point has had nothing inflated. Always false in
a program built with -Dwithout_zlib, whose server never decompresses.
Returns true when request carries a compressed body, in either of the
two forms a Crystal compiler can hand to Amber:
- The
Content-Encodingheader names a coding other thanidentity, such asgzipordeflate. Every header line and every comma-separated coding is read; empty entries andidentityin any case are ignored. Crystal 1.21.1 and later, and crystal-alpha with the GHSA-jfq5-c3x6-w7jj backport, leave the header and the raw body in place. HTTP::Serveralready wrapped the body in a decompressing reader (see.body_inflated_by_server?). Crystal before 1.21.1 does this forgzipanddeflateand deletesContent-EncodingandContent-Length, so the header check alone sees a plain request.
request = HTTP::Request.new("POST", "/", HTTP::Headers{"Content-Encoding" => "gzip"})
Amber::Pipe::Pipeline.content_encoded?(request) # => true
Instance Method Detail
Execution of this handler.