horpto/nodecap2

add support for 206 status

horpto opened this issue · 9 comments

add support for 206 status

Have you encountered a 206 status? Is there a relatively succinct way of reproducing or testing it?

@randunel
Hi, now nodecap2 are not supported 206 as this feature is not needed for our product, but I think to make it to version 3.0 or maybe earlier.
I have not encountered with 206 status. You can try to check c-icap.

@horpto I know nodecap2 doesn't support 206 status codes as icap codes, but i'm wondering whether it should be supported at all.

I've got a separate node.js icap project and I was wondering whether 206 is needed at all, since I've never encountered it so far, hence I haven't implemented it :P

@randunel
In RESPMOD I download html page (other mimes I pass) entirely or first 20 Mb (yeah, I have requirement to not crash at big html pages) and then filter it.
Some forks of nodecap2 are supported 206, I don't know for what. https://github.com/horpto/nodecap2/network

I installed package and started example/modify_html.js
then i visited simple static page and saw:

but page was not loaded in browser, response was not reseived...
i put code
console.info('I am in filter function');
to icapRes.setFilter callback, and not saw this console output, code never reach...

squid -v
Squid Cache: Version 3.5.20
Service Name: squid

tail /etc/squid/squid.conf
icap_enable on
icap_preview_size 4096

#icap_service service_req reqmod_precache bypass=1 icap://127.0.0.1:1344/request
#adaptation_access service_req allow all

icap_service service_resp respmod_precache bypass=0 icap://127.0.0.1:1344/response
adaptation_access service_resp allow all

Please, help me find what is wrong

Hi @anton-zaharov
Thanks for bugreport. Actually it's better to create a new issue with your question.
Also you can try to find me in the gitter of repo.

I am afraid examples is not in the best state and can be broken. I'll try to help you.

@anton-zaharov can you add a console.log in (1) the beginning of acceptRequest, (2) the beginning server.response('*', function(icapReq, icapRes, req, res, next) {, line 66, and (3) before icapRes.setFilter ?
what's output in this case?

Also master branch has some new changes and I need a bit of time to sort out it, check the examples, and release new version - 2.3.0 or 3.0.0, don't know.

@anton-zaharov
workaround: add icapRes.hasBody = true after icapRes.continuePreview();, (line ~100)

Thanks, now test works correctly