Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编辑完用户自定义PAC规则后不马上生效 #86

Closed
wufeiqun opened this issue Oct 10, 2016 · 35 comments
Closed

编辑完用户自定义PAC规则后不马上生效 #86

wufeiqun opened this issue Oct 10, 2016 · 35 comments
Labels

Comments

@wufeiqun
Copy link

每次更新完一个自定义的PAC规则还得关闭再打开shadowsocks,不然不会生效,希望可以每次改完都会自动重启一下~

@wufeiqun wufeiqun changed the title 编辑完用户自定义PAC规则后不自动更新 编辑完用户自定义PAC规则后不马上生效 Oct 10, 2016
@kfh101
Copy link

kfh101 commented Oct 12, 2016

的确是有这个问题, 希望可以实时刷新

@qiuyuzhou
Copy link
Collaborator

请问是通过app内窗口修改不能及时生效吗?
还是通过外部编辑器修改?

@kfh101
Copy link

kfh101 commented Oct 13, 2016

你好, 是通过APP的窗口修改,然后确定提交. APP提示用户规则已保存, 但需要断开服务器连接, 重新连接才可以浏览所新增的规则.

@wufeiqun
Copy link
Author

+1 通过app内窗口修改

@yichengchen
Copy link
Contributor

解决方法 更新pac时,pac地址后面增加随机参数?t=xxxxx 防止系统缓存pac文件。

@wufeiqun
Copy link
Author

用户通过修改user rule来修改规则,规则里好像不能加时间戳吧~

@yichengchen
Copy link
Contributor

我是指在程序代码中的改动,例如 https://github.com/yichengchen/ShadowsocksX-R/blob/268d75d3e93674dadf12013eaaa1558424aa62a6/ShadowsocksX-NG/ProxyConfHelper.m 的199行

发自我的 iPhone

在 2016年10月14日,08:34,中国娃 notifications@github.com 写道:

用户通过修改user rule来修改规则,规则里好像不能加时间戳吧~


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@qiuyuzhou
Copy link
Collaborator

@yichengchen 我看了下代码,不是这个原因,缺省是no cache的。
内嵌的GCDWebServer,不是每次从文件中读取,而是使用在启动时读取pac文件到内存中的数据。所以文件的更改了,也不会产生效果。

@yichengchen
Copy link
Contributor

是系统发现pac url没变化所以没有重新获取…,系统的缓存吧

发自我的 iPhone

在 2016年10月18日,22:31,Qiu Yuzhou notifications@github.com 写道:

@yichengchen 我看了下代码,不是这个原因,缺省是no cache的。
内嵌的GCDWebServer,不是每次从文件中读取,而是使用在启动时读取pac文件到内存中的数据。所以文件的更改了,也不会产生效果。


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@qiuyuzhou
Copy link
Collaborator

@yichengchen 不是的,是否缓存是受到特定HTTP头部控制的。

Sets the caching hint for the response using the “Cache-Control” header. This value is expressed in seconds.

The default value is 0 i.e. “no-cache”.

@yichengchen
Copy link
Contributor

但是我这么做却是在我这解决了这个问题=,=

发自我的 iPhone

在 2016年10月18日,22:34,Qiu Yuzhou notifications@github.com 写道:

@yichengchen 不是的,是否缓存是受到特定HTTP头部控制的。

Sets the caching hint for the response using the “Cache-Control” header. This value is expressed in seconds.

The default value is 0 i.e. “no-cache”.

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@qiuyuzhou
Copy link
Collaborator

我大概知道为什么了

原来的代码:

  • 在http url的handler函数中不会重新加载文件内容
  • 但是,在调disableProxy时,会去调用startPACServer?!相当于重启了服务器

浏览器确实缓存了pac,而且缓存行为不受http头Cache-Control控制。

如果加上时间戳会有另一个问题。

// 带上所有参数是为了判断是否原有代理设置是否由ssx-ng设置的。如果是用户手工设置的其他配置,则不进行清空。

与这个功能冲突,设置手动模式时,将不管用。

@qiuyuzhou
Copy link
Collaborator

重启ShadowsocksX-NG不管用,需要重启浏览器才可以。

@qiuyuzhou qiuyuzhou added the bug label Oct 18, 2016
@nightire
Copy link

老的客户端(就是在衍生 NG 以前),修改之后选择【从 GFWList 更新 PAC】就可以立刻生效。

@qiuyuzhou
Copy link
Collaborator

因为老客户端不是通过http服务器提供pac的,而是通过file:///形式的url提供的。
而在最新版的mac os10.12的safari中,不支持以本地文件形式进行auto proxy配置。
因此,现在内嵌了http服务器来提供pac,所以遇到了新问题。

@nightire
Copy link

@qiuyuzhou 然而并不是,这是使用老版的截图:

image

当然我不怎么懂其中的具体细节,我只是觉得并非你描述的那样,事实上倒是在用了 NG 版之后我发现 pac 文件竟然是 file:// 协议提供的,所以我才换回了老版一直用着。

@qinyuhang
Copy link
Contributor

老的客户端 衍生ng之前指的是原版的吗?那个也是用的gcdwebserver来做中转的

Qiu Yuzhou notifications@github.com于2016年10月18日 周二23:38写道:

因为老客户端不是通过http服务器提供pac的,而是通过file:///形式的url提供的。
而在最新版的mac os10.12的safari中,不支持以本地文件形式进行auto proxy配置。
因此,现在内嵌了http服务器来提供pac,所以遇到了新问题。


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#86 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF8zUf68OTkj9-UknvE7UEfvAJm_Ah1vks5q1OfdgaJpZM4KSV9x
.

@qiuyuzhou
Copy link
Collaborator

也没加时间戳后缀,当初怎么实现的?

@nightire
Copy link

@qinyuhang 对的,就是原版那个,最后的版本好像是 2.6.3?

@qiuyuzhou
Copy link
Collaborator

Crash 的bug修好了我先发个1.3.1版吧,这个bug晚点修

@nightire
Copy link

@qiuyuzhou 我刚才仔细确认了一下,我用的是别人改过的版本,2.6.5,就是之前 gfwlist 不能用的那段时间某人的改进版,我不知道对这个问题他有没有改动,这是源码:https://github.com/RobertYan/ShadowsocksX

@qiuyuzhou
Copy link
Collaborator

@nightire Thanks
我看了老版的代码
他写了段代码监控pac文件是否改变,如果改变就触发

if (isRunning) {
        [self toggleSystemProxy:NO];
        [self toggleSystemProxy:YES];
    }

相当于把系统代理设置置空,再加上。

@qiuyuzhou
Copy link
Collaborator

也就是说只要把系统代理设置置空,再加上就可以触发浏览器刷新。

@anxsec
Copy link

anxsec commented Nov 25, 2016

v1.3.2仍然存在这个问题,需要手动off/on才生效

@Parahexen
Copy link

呃呃呃呃呃呃……还没解决么?

@liliass
Copy link

liliass commented Jan 5, 2017

The issue still exist. I can't add any user rule at all.

example,
||ip.cn

no matter Auto/Manual mode.
Please help

V1.3.2 and R8 version

@jeremy125
Copy link

我现在的解决办法是:
1、加规则至user-rule.txt中,如
||ip.cn/
2、从GFWList更新本地PAC
3、禁用,再启用系统代理。
然后就可以将用户规则生效,程序本身当前暂时还没有即时生效的机制。

@qiuyuzhou
Copy link
Collaborator

@liliass 你用的应该是ssr的衍生版,走错门了。

@myliyifei
Copy link

遇到同样的问题,截止到1.6.1版本,个人自定义的PAC还是不能优先覆盖gfwlist下载的版本。

@notHide
Copy link

notHide commented Oct 24, 2017

我的解决办法是:
1.编辑 pac 后“关闭 Shadowsocks”,然后再“打开 Shadowsocks”
2.重启浏览器
然后一切正常了

@HugoDing
Copy link

HugoDing commented Nov 2, 2017

还是GoAgentX好使啊,但是不支持chacha20加密~~

@sickate
Copy link

sickate commented Apr 16, 2018

1.7.1 still has this issue.

@jearton
Copy link

jearton commented Jan 30, 2019

1.8.2还是有这个问题

@y0unghe
Copy link

y0unghe commented Dec 13, 2019

我的解决办法是:
1.编辑 pac 后“关闭 Shadowsocks”,然后再“打开 Shadowsocks”
2.重启浏览器
然后一切正常了

试过,不用重启浏览器也可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

17 participants