A minimal working ICAP server and client implementation in Go, designed for testing RESPMOD (response modification) use cases like keyword-based content filtering.
- Supports
RESPMOD(response modification) - Parses full ICAP and embedded HTTP payloads
- Blocks responses with banned keywords like
drugs,sex,violence - Returns
403 Forbiddenwhen content matches, or204 No Contentotherwise - Includes a CLI test client that sends an ICAP RESPMOD request with an embedded HTTP response
- Go 1.18+
- No dependencies or external libraries
go run icap-server.goYou should see:
ICAP server running on :1344
Create a test payload (that should be blocked):
echo "this contains drugs" > test.txtRun the client:
go run icap-client.go localhost:1344 /respmod test.txtExpected output:
ICAP/1.0 200 OK
Encapsulated: res-hdr=0, res-body=75
HTTP/1.1 403 Forbidden
Content-Type: text/plain
Blocked by ICAP filter.
Clean text test:
echo "hello world" > test.txt
go run icap-client.go localhost:1344 /respmod test.txtExpected output:
ICAP/1.0 204 No Content
Encapsulated: null-body=0