Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-10580

ConnectionAdapter encodes the path and query whereas the Connection class didn't

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 6.16.0
    • Fix Version/s: PUP 6.17.0
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      6.16.0 introduced a regression that caused query parameters to be double URL encoded. This restores the behavior that existed previously. Puppet expects the caller to URL encode query parameters that are passed to the Puppet::Network::HTTP::Connection methods.
      Show
      6.16.0 introduced a regression that caused query parameters to be double URL encoded. This restores the behavior that existed previously. Puppet expects the caller to URL encode query parameters that are passed to the Puppet::Network::HTTP::Connection methods.
    • QA Risk Assessment:
      Needs Assessment

      Description

      A regression in 6.16.0 causes puppet to encode paths and queries when calling the legacy HTTP API Puppet::Network::HttpPool. To reproduce, given the following code:

      require 'puppet'
      require 'puppet/network/http_pool'
       
      Puppet.initialize_settings(['--http_debug'])
      query = URI.escape({ 'a' => 'b' }.to_json)
       
      http = Puppet::Network::HttpPool.http_instance('www.google.com', 80, false, false)
      http.get("/foo%20bar?q=#{query}")
      

      In 6.16.0 it results in:

      $ bx ruby http.rb
      opening connection to www.google.com:80...
      opened
      Conn transport_request
      Conn begin_transport
      <- "GET /foo%2520bar?q=%257B%2522a%2522%3A%2522b%2522%257D HTTP/1.1
      

      Whereas in 6.15.0:

      $ bx ruby http.rb
      opening connection to www.google.com:80...
      opened
      Conn transport_request
      Conn begin_transport
      <- "GET /foo%20bar?q=%7B%22a%22:%22b%22%7D HTTP/1.1
      

      Note the different levels of encoding on the GET request line.

      This issue was introduced in PUP-10289 when switching over to the ConnectionAdapter. See https://github.com/puppetlabs/puppet/pull/8166#commitcomment-40394792

      /cc Vadym Chepkov

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              josh Josh Cooper
              Reporter:
              josh Josh Cooper
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support