<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hello all... I would really appreciate some help.<br><br></div>So I have written an external acl helper in C++ that talks to a REST API that I developed. Here is a github link (don't worry, it is pretty short, and the only parts you need to look at are lines 46, 52, 58 and 60):<br><br><a href="https://github.com/e2guardian-angel/squid-acl-category-helper/blob/main/category_host.cpp">https://github.com/e2guardian-angel/squid-acl-category-helper/blob/main/category_host.cpp</a><br><br></div>I have it all configured in my squid.conf:<br><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">external_acl_type host_category_helper %ACL %DST /usr/local/bin/squidhelpers/host_category_helper
</span><br>acl searchengines external host_category_helper<br>...<br><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">ssl_bump bump searchengines
</span><br>ssl_bump none all</span></span><br><br></div>and as far as I can tell, it is working: search engines are being matched (for the most part) and decrypted, as expected, and nothing else is being decrypted.<br><br></div>However, I am seeing a million of the following lines:<br><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">2021/05/08 02:04:57| helperHandleRead: unexpected read from host_category_helper #Hlpr6, 4 bytes 'ERR<br></span><br></span></div>I notice it only seems to be happening for the ERR (no match), I don't see it for the OK (match).<br><br></div>I googled this issue and see a lot of threads here about making sure there is only one line of output per line of input. I am definitely seeing this when I just run the helper manually:<br><span style="font-family:monospace"><span style="font-weight:bold;color:rgb(84,84,255);background-color:rgb(255,255,255)">$</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"> docker exec -it squid /usr/local/bin/squidhelpers/host_category_helper </span><br>searchengines <a href="http://google.com">google.com</a>
<br>OK
<br>searchengines <a href="http://facebook.com">facebook.com</a>
<br>ERR
<br>searchengines <a href="http://imdb.com">imdb.com</a>
<br>ERR<br></span><br><br></div>So it seems that it should be working as expected. I don't see any other newlines. I saw also some snippet about concurrency being an issue, this could be the case, since I did see this one-off in the squid output:<br><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">2021/05/08 02:04:59| helperHandleRead: unexpected read from host_category_helper #Hlpr6, 8 bytes 'ERR
</span><br>ERR
<br>'</span><br><br></div>But this doesn't make sense to me since only one helper appears to be running:<br><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">2021/05/08 01:52:04| helperOpenServers: Starting 1/5 'host_category_helper' processes</span><br>
<br></span><br>Is there anything glaring here that could be the issue? Is it indeed a concurrency problem? I would have assumed that each helper (there are 5 of them) would have their own stdin/stdout and be writing to/from it rather than everyone at once. It also seems a little suspicious that I am only seeing this for ERR, not OK... you are supposed to print ERR when there is not a match, correct?<br><br></div>Any help would be greatly appreciated... I am getting so close to having this fully functional.<br><br></div>-Justin<br></div>