tp2 0.11.1 → 0.11.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73f9fa79516460ea4b1c6226f2969fe0af0b394df2beec87263d94c75d9879f0
4
- data.tar.gz: bbb636a70ec52928b55841ba8476ae59bdf585c4e15ae5d469b2e936787933ce
3
+ metadata.gz: 69d5ffc704823ef9650889a3b0ce785aa9aae379905940672ad89ecb6dca0d2b
4
+ data.tar.gz: 8375c0c32f27279c104351821c2dc07ec5dd7ae5b735b64ce3d5dfa774a95c64
5
5
  SHA512:
6
- metadata.gz: 06f10bbc8c78af9a5cb0ff9dae4058a865144499f825b4d0a5496dab772ee9987750f0afed2eed392104007739498ae8e00a81bd27719910531cb03a6e283acc
7
- data.tar.gz: e9dfa954dc71eaea7a6953c9896eaf40ed0ebd1c69883f482fc007a29c650382297b359308bdf27b0ea881c117828bda13b3fc457ebb306e0e16489f7f52ab30
6
+ metadata.gz: c6c9ac7ee73752d17d56dcdbb9d87bb74a0712f93328f7b8d57352de069595b45e9cf94d67f178828e39ee2a792e19f760550e9c2d08f7e11f3eaeb929e56e16
7
+ data.tar.gz: e0665223dba5271296c2fa8ab4aa624a280a97a86af609e9fd3ff5b9a3f215b65012f7d077f1fca3a5dc8dd698fbe96a8294c87d76bd2383a552aadb064c4bc5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 0.11.2 2025-06-15
2
+
3
+ - Improve URI calculation for logging
4
+
1
5
  # Version 0.11.1 2025-06-15
2
6
 
3
7
  - Add more info to log
@@ -208,17 +208,28 @@ module TP2
208
208
  return if !@opts[:log]
209
209
 
210
210
  request_headers = request.headers
211
+ uri = full_uri(request_headers)
212
+
211
213
  str = format(
212
214
  "%<client_ip>s %<method>s %<uri>s %<status>s %<tx>d",
213
215
  client_ip: request.forwarded_for || '?',
214
216
  method: request_headers[':method'].upcase,
215
- uri: request.full_uri,
217
+ uri: uri,
216
218
  status: @status,
217
219
  tx: request_headers[':tx']
218
220
  )
219
221
  @opts[:log].log(str)
220
222
  end
221
223
 
224
+ def full_uri(headers)
225
+ format(
226
+ "%s://%s%s",
227
+ headers['x_forwarded_proto'] || 'http',
228
+ headers['host'],
229
+ headers[':path']
230
+ )
231
+ end
232
+
222
233
  RE_REQUEST_LINE = /^([a-z]+)\s+([^\s]+)\s+(http\/[0-9\.]{1,3})/i.freeze
223
234
  RE_HEADER_LINE = /^([a-z0-9\-]+)\:\s+(.+)/i.freeze
224
235
  MAX_REQUEST_LINE_LEN = 1 << 14 # 16KB
@@ -252,7 +263,6 @@ module TP2
252
263
  headers[m[1].downcase] = m[2]
253
264
  end
254
265
 
255
- headers[':scheme'] = headers['x_forwarded_proto'] || 'http'
256
266
  headers
257
267
  end
258
268
 
data/lib/tp2/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TP2
2
- VERSION = '0.11.1'
2
+ VERSION = '0.11.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tp2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner