aws-sigv4 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aws-sigv4/signer.rb +15 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 522eb318a39edd34b0c8cf779ed6cd8c9205f029a839542e6cb7cbc17d8ad05a
4
- data.tar.gz: 1795295c553af7c4d328f4d1ef0975dbe96b88d51c7ee3965c8570474a1b3a7d
3
+ metadata.gz: 3f598a45b85be9ca9687eef1ee700397b1a6f273f8633d3c6f5dcc0d5bf6c649
4
+ data.tar.gz: 15d37434086264b0d6f87b0b77d32cff6a70e13eb5746b1aafa89d2c85d91335
5
5
  SHA512:
6
- metadata.gz: ce6b0e0987b50035d9837e4ad779f576a9ffec669c37fb09e128863630e8ecc5d86639ce350bd72a03803593fc21cdce1bc5c2e74fc29bd749e1c25f949dd052
7
- data.tar.gz: 9bc973d9b286e07773523071b1be61f02797637efb93ab2d5e330abd66f45b4102479adfd979d7f665d7719eacd065c7bf1624ff773f4140bbe1e7cca2caf903
6
+ metadata.gz: e9bbfd21088c2ee7821fff70b4d25d21173cecfdeab77e37ea36ce7664ae21aeb2122615ccee12de783116f53d2fc360d82d136d74c98589d595e0522c7d170d
7
+ data.tar.gz: 94d8676dde1b46f5fb760a29cbac9e16f63ac30e6a08310a91230054e69dfb10f92b1d4470964c427f59c5843b8a6a5abf331df3e86428c757dc386ae9b3b347
@@ -507,18 +507,26 @@ module Aws
507
507
  def normalized_querystring(querystring)
508
508
  params = querystring.split('&')
509
509
  params = params.map { |p| p.match(/=/) ? p : p + '=' }
510
- # We have to sort by param name and preserve order of params that
511
- # have the same name. Default sort <=> in JRuby will swap members
510
+ # From: https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
511
+ # Sort the parameter names by character code point in ascending order.
512
+ # Parameters with duplicate names should be sorted by value.
513
+ #
514
+ # Default sort <=> in JRuby will swap members
512
515
  # occasionally when <=> is 0 (considered still sorted), but this
513
516
  # causes our normalized query string to not match the sent querystring.
514
- # When names match, we then sort by their original order
515
- params = params.each.with_index.sort do |a, b|
517
+ # When names match, we then sort by their values. When values also
518
+ # match then we sort by their original order
519
+ params.each.with_index.sort do |a, b|
516
520
  a, a_offset = a
517
- a_name = a.split('=')[0]
518
521
  b, b_offset = b
519
- b_name = b.split('=')[0]
522
+ a_name, a_value = a.split('=')
523
+ b_name, b_value = b.split('=')
520
524
  if a_name == b_name
521
- a_offset <=> b_offset
525
+ if a_value == b_value
526
+ a_offset <=> b_offset
527
+ else
528
+ a_value <=> b_value
529
+ end
522
530
  else
523
531
  a_name <=> b_name
524
532
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sigv4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-eventstream