squid external_acl_type 并发响应

squid external_acl_type concurrent response

下午好。请教各位大佬,跟个squid搞个明白,跟个python交个朋友不出来。我正在为鱿鱼写一个异步助手。鱿鱼调到:

external_acl_type aclproxy3 ttl = 300 children-max = 1 concurrency = 100% LOGIN python -u /opt/agent/helper.py proxy3.

Squid 通过编号将请求发送给助手。 ['0', 'data'], ['1', 'data'] 码头说:

The helper receives lines expanded per the above format specification and for each input line returns 1 line starting with OK/ERR/BH result code and optionally followed by additional keywords with more details.

但我不明白如何形成答案。事实上,请求将按 1、2、3 的顺序出现,并在 2、1、3 中得到满足。因此,还需要确定答案。但是怎么办? 在这个阶段,我按照在gevent栈上写的方式解决了问题。事实上,所有的请求都是先添加的,然后所有的都按顺序处理结果是OK/ERR按照来的顺序,如果第2个和第3个请求已经处理完了,那么就等待第一个顺序结束,全部按顺序回答。 这是一个骰子,我明白了。所以我征求意见,有人可以挖掘这个话题吗?感谢任何提示

在文档中找到了答案

When using the concurrency= option the protocol is changed by introducing a query channel tag in front of the request/response. The query channel tag is a number between 0 and concurrency-1. This value must be echoed back unchanged to Squid as the first part of the response relating to its request. Blockquote

也就是我们在Stdin上获取,例如:[0, data], [1, data] ... 并且必须 return 1 OK,0 ERR