Jira (PUP-10580) ConnectionAdapter encodes the path and query whereas the Connection class didn't

10 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Jul 6, 2020, 4:57:03 PM7/6/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Puppet / Bug PUP-10580
ConnectionAdapter encodes the path and query whereas the Connection class didn't
Change By: Josh Cooper
Sprint: Platform Core KANBAN
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Jul 6, 2020, 4:57:04 PM7/6/20
to puppe...@googlegroups.com
Josh Cooper created an issue
Issue Type: Bug Bug
Affects Versions: PUP 6.16.0
Assignee: Unassigned
Created: 2020/07/06 1:56 PM
Fix Versions: PUP 6.17.0
Priority: Normal Normal
Reporter: Josh Cooper

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

Josh Cooper (Jira)

unread,
Jul 6, 2020, 4:57:04 PM7/6/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jul 6, 2020, 4:57:04 PM7/6/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jul 7, 2020, 2:50:03 PM7/7/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10580
 
Re: ConnectionAdapter encodes the path and query whereas the Connection class didn't

Merged to master in e4b8027db1 and passed in same SHA

Josh Cooper (Jira)

unread,
Jul 7, 2020, 2:52:04 PM7/7/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Bug Fix
Release Notes Summary: 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.
Reply all
Reply to author
Forward
0 new messages