Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jan 2022 17:04:59 -0600
From:      Edgar Pettijohn <edgar@pettijohn-web.com>
To:        freebsd-questions@FreeBSD.org
Subject:   how to use accf_http
Message-ID:  <84ecd56f-e9d5-00c6-fc71-44ec06951f65@pettijohn-web.com>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------JUKunxzx0GQj0bKzTbtPs6DZ
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

I've loaded the accf_http module. I tested it with the attached program, 
but it doesn't work as expected. I tested by telneting in and sending 
the word `hi'. I didn't expect this to make it through, but maybe I'm 
not understanding the accf_http filter. I then tested with curl which I 
would have expected to make it through anyway. Am I using it wrong?

Thanks,

Edgar

edgar@bsd:~ $ sudo ./accf-http
received:
hi
received:
HEAD / HTTP/1.1
Host: localhost
User-Agent: curl/7.79.1
Accept: */*



--------------JUKunxzx0GQj0bKzTbtPs6DZ
Content-Type: text/x-csrc; charset=UTF-8; name="accf-http.c"
Content-Disposition: attachment; filename="accf-http.c"
Content-Transfer-Encoding: base64

I2luY2x1ZGUgPHN5cy90eXBlcy5oPgojaW5jbHVkZSA8c3lzL3NvY2tldC5oPgoKI2luY2x1
ZGUgPG5ldGRiLmg+CgojaW5jbHVkZSA8ZXJyLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5j
bHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8dW5pc3RkLmg+
CgppbnQKbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKICAgIGludCBzb2NrLCBydiwg
bmV3ZmQ7CiAgICBpbnQgeWVzID0gMTsKCiAgICBjaGFyIGJ1ZltCVUZTSVpdOwoKICAgIHNz
aXplX3QgbmJ5dGVzOwoKICAgIHN0cnVjdCBhZGRyaW5mbyBoaW50cywgKmFpLCAqcDsKICAg
IHN0cnVjdCBhY2NlcHRfZmlsdGVyX2FyZyB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4oc29jaywgLTEpID09IC0x
KQogICAgICAgIGVycigxLCAibGlzdGVuIik7CgogICAgaWYgKChzZXRzb2Nrb3B0KHNvY2ss
IFNPTF9TT0NLRVQsIFNPX0FDQ0VQVEZJTFRFUiwgJmFmYSwgc2l6ZW9mKGFmYSkpKSA9PSAt
MSkKICAgICAgICBlcnJ4KDEsICIlcyIsIHN0cmVycm9yKGVycm5vKSk7CgphZ2FpbjoKICAg
IG5ld2ZkID0gYWNjZXB0KHNvY2ssIChzdHJ1Y3Qgc29ja2FkZHIgKikmcmVtb3RlLCAmYWRk
cmxlbik7CgogICAgaWYgKG5ld2ZkID09IC0xKQogICAgewogICAgICAgIHdhcm4oImFjY2Vw
dCIpOwogICAgICAgIGdvdG8gYWdhaW47CiAgICB9CgogICAgbmJ5dGVzID0gcmVjdihuZXdm
ZCwgYnVmLCBCVUZTSVosIDApOwoKICAgIGlmIChuYnl0ZXMgPD0gMCkKICAgIHsKICAgICAg
ICBpZiAobmJ5dGVzID09IDApCiAgICAgICAgICAgIHByaW50Zigic29ja2V0ICVkIGh1bmcg
dXBcbiIsIG5ld2ZkKTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHdhcm4oInJlY3YiKTsK
ICAgICAgICBjbG9zZShuZXdmZCk7CiAgICAgICAgZ290byBhZ2FpbjsKICAgIH0KCiAgICBw
cmludGYoInJlY2VpdmVkOlxuJXMiLCBidWYpOwogICAgY2xvc2UobmV3ZmQpOwogICAgZ290
byBhZ2FpbjsKCiAgICByZXR1cm4gMDsKfQo=

--------------JUKunxzx0GQj0bKzTbtPs6DZ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?84ecd56f-e9d5-00c6-fc71-44ec06951f65>