@@ -126,10 +126,6 @@ func (m *MatchExpression) Provision(ctx caddy.Context) error {
126126 // light (and possibly naïve) syntactic sugar
127127 m .expandedExpr = placeholderRegexp .ReplaceAllString (m .Expr , placeholderExpansion )
128128
129- // rewrite isTransportError() to isTransportError(req) so the
130- // function receives the request context
131- m .expandedExpr = transportErrorRegexp .ReplaceAllString (m .expandedExpr , transportErrorExpansion )
132-
133129 // as a second pass, we'll strip the escape character from an escaped
134130 // placeholder, so that it can be used as an input to other CEL functions
135131 m .expandedExpr = escapedPlaceholderRegexp .ReplaceAllString (m .expandedExpr , escapedPlaceholderExpansion )
@@ -172,11 +168,6 @@ func (m *MatchExpression) Provision(ctx caddy.Context) error {
172168 []* cel.Type {httpRequestObjectType , cel .StringType },
173169 cel .AnyType ,
174170 )),
175- cel .Function (CELTransportErrorFuncName , cel .SingletonUnaryBinding (isTransportErrorFunc ), cel .Overload (
176- CELTransportErrorFuncName + "_httpRequest" ,
177- []* cel.Type {httpRequestObjectType },
178- cel .BoolType ,
179- )),
180171 cel .Variable (CELRequestVarName , httpRequestObjectType ),
181172 cel .CustomTypeAdapter (m .ta ),
182173 ext .Strings (),
@@ -218,10 +209,6 @@ func (m MatchExpression) Match(r *http.Request) bool {
218209 return match
219210}
220211
221- // CanMatchResponse is a marker indicating that expression matchers
222- // may reference response data via placeholders like {rp.status_code}
223- func (m MatchExpression ) CanMatchResponse () {}
224-
225212// MatchWithError returns true if r matches m.
226213func (m MatchExpression ) MatchWithError (r * http.Request ) (bool , error ) {
227214 celReq := celHTTPRequest {r }
@@ -293,29 +280,6 @@ func (m MatchExpression) caddyPlaceholderFunc(lhs, rhs ref.Val) ref.Val {
293280 return m .ta .NativeToValue (val )
294281}
295282
296- // isTransportErrorFunc implements the isTransportError() CEL function
297- // that returns true when the evaluation is happening during a transport
298- // error retry decision (as opposed to a response-based retry decision)
299- func isTransportErrorFunc (val ref.Val ) ref.Val {
300- celReq , ok := val .(celHTTPRequest )
301- if ! ok {
302- return types .NewErr (
303- "invalid request of type '%v' to %s(request)" ,
304- val .Type (),
305- CELTransportErrorFuncName ,
306- )
307- }
308- repl , ok := celReq .Context ().Value (caddy .ReplacerCtxKey ).(* caddy.Replacer )
309- if ! ok || repl == nil {
310- return types .Bool (false )
311- }
312- v , _ := repl .Get ("http.reverse_proxy.is_transport_error" )
313- if b , ok := v .(bool ); ok {
314- return types .Bool (b )
315- }
316- return types .Bool (false )
317- }
318-
319283// httpRequestCELType is the type representation of a native HTTP request.
320284var httpRequestCELType = cel .ObjectType ("http.Request" , traits .ReceiverType )
321285
@@ -850,10 +814,6 @@ var (
850814 placeholderRegexp = regexp .MustCompile (`([^\\]|^){([a-zA-Z][\w.-]+)}` )
851815 placeholderExpansion = `${1}ph(req, "${2}")`
852816
853- // rewrite isTransportError() calls to pass the request object
854- transportErrorRegexp = regexp .MustCompile (`isTransportError\(\)` )
855- transportErrorExpansion = `isTransportError(req)`
856-
857817 // As a second pass, we need to strip the escape character in front of
858818 // the placeholder, if it exists.
859819 escapedPlaceholderRegexp = regexp .MustCompile (`\\{([a-zA-Z][\w.-]+)}` )
@@ -867,10 +827,6 @@ var httpRequestObjectType = cel.ObjectType("http.Request")
867827// The name of the CEL function which accesses Replacer values.
868828const CELPlaceholderFuncName = "ph"
869829
870- // The name of the CEL function that checks if the current evaluation
871- // context is a transport error (connection succeeded but roundtrip failed)
872- const CELTransportErrorFuncName = "isTransportError"
873-
874830// The name of the CEL request variable.
875831const CELRequestVarName = "req"
876832
0 commit comments