New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hrt

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hrt - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

2

package.json
{
"name": "hrt",
"version": "1.0.10",
"version": "1.0.11",
"description": "HTTP Rewrite Tool",

@@ -5,0 +5,0 @@ "author": "Longhao Luo <lhluo@tudou.com>",

@@ -9,3 +9,3 @@ var Path = require('path');

function stripVersionInfo(url) {
return url.replace(/([^?]+)_\d+(\.(?:js|css|swf))/i, '$1$2');
return url.replace(/([^?]+)_\d+(\.(?:js|css|swf|png|jpg|gif))/i, '$1$2');
}

@@ -12,0 +12,0 @@

@@ -8,12 +8,6 @@ HTTP Rewrite Tool

1. 源代码安装
```
git clone git://github.com/tudouui/hrt.git
```
```
npm install hrt -g
```
2. NPM安装
```
npm install hrt -g
```
### 使用方法

@@ -71,2 +65,18 @@

```
注:当配置文件里有 `exports.merge` 时会接管所有请求,所以在程序逻辑里需要加入文件类型判断。
注:当配置文件里有 `exports.merge` 时会接管所有请求,所以在程序逻辑里需要加入文件类型判断。
3. 修改URL内容。
```js
exports.merge = function(path, callback) {
if (/^http:\/\/(www|wwwtest|beta)\.tudou\.com\/programs\/view\//.test(this.req.url)) {
this.util.get(this.req.url, 'gbk', function(body) {
callback('text/html', body + '<!-- test -->', 'gbk');
});
return;
}
// 其它请求
var contentType = require('mime').lookup(path);
var buffer = this.util.readFileSync(path);
return callback(contentType, buffer);
};
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc