Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3584

Https helper functions return wrong values if server name equals application context name

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.0.7, 8.0.4.1
    • Fix Version/s: 8.5.0
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Steps to Reproduce

      Examples using Https.getCompleteContext(), but this issue applies to all methods in Https using indexOf to split the url
      -getCompleteContext
      -getCompleteServerName
      -possible other methods?

      Setup a ZK application where context = server name.
      Easiest: App context: localhost, server = localhost
      Use Https helper functions to get values from the current request such as:
      String completeContext = Https.getCompleteContext(((HttpServletRequest)Executions.getCurrent().getNativeRequest()));

      Actual Result

      With context name = server name
      getCompleteContext returns:
      https://localhost

      Expected Result

      With context name != server name
      getCompleteContext returns:
      https://localhost:8443/localhostdifferent

      Debug Info

      Root Cause

      sb.indexOf(ctx) will always return the first position of the context string. If the context string appear more than once (server name and context name) then the returned value will be incorect, as the string is cut too early

        Attachments

          Activity

            People

            Assignee:
            rudyhuang rudyhuang
            Reporter:
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h