Search code examples
pythonsquid

squid external_acl_type concurrent response


Good afternoon. I ask your advice as to understand with a squid and to make friends with a python does not come out. I'm writing an asynchronous helper to a squid. Squid tuned to:

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

Squid sends requests to the helper by numbering them. ['0', 'data'], ['1', 'data'] The dock says that:

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.

But I do not understand how to form an answer. In fact, the requests will come in the order of 1,2,3 and be fulfilled 2,1,3. So the answers need to be identified as well. But how? At this stage, I solved the problem the way it was written on the gevent stack. In fact, all the requests are added first, then all are processed in an order and the result is OK / ERR in the same order in which they came, and if the 2nd and 3rd, th requests have been processed, then they wait for the end of the first order to answer all in order. This is a dice, I understand. So I ask advice, can someone already dig this topic. Thanks for any hint


Solution

  • The answer was found in the documentation

    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

    That is, we get on Stdin, for example: [0, data], [1, data] ... and must return 1 OK, 0 ERR