@warren-bank/hls-proxy 3.5.3 → 3.5.4

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 (2) hide show
  1. package/hls-proxy/utils.js +13 -3
  2. package/package.json +1 -1
@@ -120,11 +120,21 @@ const debug = function() {
120
120
  }
121
121
  }
122
122
 
123
- const normalize_req_headers = function(req_headers) {
123
+ const normalize_req_headers = function(req_headers, blacklist) {
124
124
  const normalized = {}
125
125
 
126
+ if (blacklist && !Array.isArray(blacklist))
127
+ blacklist = null
128
+ if (blacklist)
129
+ blacklist = blacklist.filter(val => val && (typeof val === 'string')).map(val => val.toLowerCase())
130
+ if (blacklist && !blacklist.length)
131
+ blacklist = null
132
+
126
133
  for (let name in req_headers) {
127
- normalized[ name.toLowerCase() ] = req_headers[name]
134
+ const lc_name = name.toLowerCase()
135
+
136
+ if (!blacklist || (blacklist.indexOf(lc_name) === -1))
137
+ normalized[lc_name] = req_headers[name]
128
138
  }
129
139
 
130
140
  return normalized
@@ -134,7 +144,7 @@ const get_request_options = function(params, url, is_m3u8, referer_url, inbound_
134
144
  const {copy_req_headers, req_headers, req_options, hooks, http_proxy} = params
135
145
 
136
146
  const copied_req_headers = (copy_req_headers && inbound_req_headers && (inbound_req_headers instanceof Object))
137
- ? normalize_req_headers(inbound_req_headers)
147
+ ? normalize_req_headers(inbound_req_headers, ['host'])
138
148
  : null
139
149
 
140
150
  const additional_req_options = (hooks && (hooks instanceof Object) && hooks.add_request_options && (typeof hooks.add_request_options === 'function'))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@warren-bank/hls-proxy",
3
3
  "description": "Node.js server to proxy HLS video streams",
4
- "version": "3.5.3",
4
+ "version": "3.5.4",
5
5
  "scripts": {
6
6
  "start": "node hls-proxy/bin/hlsd.js",
7
7
  "sudo": "sudo node hls-proxy/bin/hlsd.js"