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

Regex predicate does not handle null values correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 1.1.2.Final, 1.2.0.Beta7
    • 1.1.1.Final, 1.2.0.Beta6
    • Core
    • None

    Description

      gzip filter has predicate support. response-header filter seems to ignore predicates.
      It would be great to add predicate support to the response-header filter in the same way as it is working for gzip filter. Thus it would be possible to set response-header values dependent on other header values. This is interesting for setting a correct "Vary:" header value.

      If using the predicate

      predicate="regex[pattern='(?:application/javascript|text/css|text/html)(;.*)?', value=%{o,Content-Type}, full-match=true]"
      

      for filter-ref of a response-header filter request result in a 500 error producing the following stack trace in the log:

      ^[[0m^[[31m17:05:15,286 ERROR [io.undertow.request] (default I/O-1) Blocking request failed HttpServerExchange{ GET /}: java.lang.NullPointerException
              at java.util.regex.Matcher.getTextLength(Matcher.java:1283) [rt.jar:1.8.0_25]
              at java.util.regex.Matcher.reset(Matcher.java:309) [rt.jar:1.8.0_25]
              at java.util.regex.Matcher.<init>(Matcher.java:229) [rt.jar:1.8.0_25]
              at java.util.regex.Pattern.matcher(Pattern.java:1093) [rt.jar:1.8.0_25]
              at io.undertow.predicate.RegularExpressionPredicate.resolve(RegularExpressionPredicate.java:41)
              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:24)
              at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:66)
              at io.undertow.server.handlers.RequestLimit.handleRequest(RequestLimit.java:103)
              at io.undertow.server.handlers.RequestLimitingHandler.handleRequest(RequestLimitingHandler.java:81) 
              at io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:57)
              at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)
              at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:43)
              at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:158)
              at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
              at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:156)
              at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:91)
              at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:45)
              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.2.2.Final.jar:3.2.2.Final]
              at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.2.2.Final.jar:3.2.2.Final] 
              at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87) [xnio-nio-3.2.2.Final.jar:3.2.2.Final]
              at org.xnio.nio.WorkerThread.run(WorkerThread.java:539) [xnio-nio-3.2.2.Final.jar:3.2.2.Final]
      

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            dimaki@gmx.de D T (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: