akita-har_logger 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a4d073bcb2347b0527e3dab531c77770a29c29326bf76cb2ca09724206af8e5
4
- data.tar.gz: 2fc8b6e0b4721699f87a08ba098b3d6137835b14c01eeb73b945a453a98267f2
3
+ metadata.gz: 51fcd2da35cb17ecb365988d7975f746a717f12b002d3a20f1d0c3eab245b10c
4
+ data.tar.gz: 4972d841dfc7c8dcd41085137d45faedeb450836d46e6d3f14d584785d997a24
5
5
  SHA512:
6
- metadata.gz: f07983494e000f9ed64ffdfe346869bdd0b574db21210a39de0199d1df81f877262c2623c72ca918c792cff77a29872224a5ba3d5f3ac12691381d8caf89bc17
7
- data.tar.gz: 513be52cfaf7f114cb95ed33df45528336db9f9945ac5252db12a9abfe30103308cd1d7d92585ec6ac8897c231129e0d83cee596a3df3034946c88b5c59dcde6
6
+ metadata.gz: 8fdffa25d122a573e8c72526934e5e713fbdc573c0d4ebfa13383d749ea856f9b01d2e5bc43e89b1c152df64f97cd965ad54bd5a4ebab924d222a1829bbbec60
7
+ data.tar.gz: 8ca06a98ce89ec4e9c3e6ac7f3b10ec98f73c44aacab1af0bac8c81649f342ec721017ee57ff6590c93a24234cce9d40c9b341aa8277a39a59bc86a3a9c3484e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- akita-har_logger (0.2.3)
4
+ akita-har_logger (0.2.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,9 +4,9 @@ module Akita
4
4
  module HarLogger
5
5
  class HarUtils
6
6
  # Rack apparently uses 8-bit ASCII for everything, even when the string
7
- # is not 8-bit ASCII. This reinterprets the given string as UTF-8.
7
+ # is not 8-bit ASCII. This reinterprets 8-bit ASCII strings as UTF-8.
8
8
  def self.fixEncoding(v)
9
- if v == nil || v.encoding == Encoding::UTF_8 then
9
+ if v == nil || v.encoding != Encoding::ASCII_8BIT then
10
10
  v
11
11
  else
12
12
  String.new(v).force_encoding(Encoding::UTF_8)
@@ -25,7 +25,7 @@ module Akita
25
25
 
26
26
  # Obtains the status text corresponding to a status code.
27
27
  def getStatusText(status)
28
- Rack::Utils::HTTP_STATUS_CODES[status]
28
+ HarUtils.fixEncoding(Rack::Utils::HTTP_STATUS_CODES[status])
29
29
  end
30
30
 
31
31
  # Obtains the HTTP version in the response.
@@ -65,8 +65,8 @@ module Akita
65
65
  if match then cookie_value = match[1] end
66
66
 
67
67
  result << {
68
- name: cookie_name,
69
- value: cookie_value,
68
+ name: HarUtils.fixEncoding(cookie_name),
69
+ value: HarUtils.fixEncoding(cookie_value),
70
70
  }
71
71
  }
72
72
 
@@ -79,14 +79,14 @@ module Akita
79
79
  text = +""
80
80
  body.each { |part|
81
81
  # XXX Figure out how to join together multi-part bodies.
82
- text << part;
82
+ text << (HarUtils.fixEncoding part);
83
83
  }
84
84
 
85
85
  {
86
86
  size: getBodySize(body),
87
87
 
88
88
  # XXX What to use when no Content-Type is given?
89
- mimeType: headers['Content-Type'],
89
+ mimeType: HarUtils.fixEncoding(headers['Content-Type']),
90
90
 
91
91
  text: text,
92
92
  }
@@ -95,7 +95,9 @@ module Akita
95
95
  def getRedirectUrl(headers)
96
96
  # Use the "Location" header if it exists. Otherwise, based on some HAR
97
97
  # examples found online, it looks like an empty string is used.
98
- headers.key?('Location') ? headers['Location'] : ''
98
+ headers.key?('Location') ?
99
+ HarUtils.fixEncoding(headers['Location']) :
100
+ ''
99
101
  end
100
102
 
101
103
  def getHeadersSize(env, status, headers)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Akita
4
4
  module HarLogger
5
- VERSION = "0.2.3"
5
+ VERSION = "0.2.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akita-har_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Liu