Search squid archive

Re: Adding headers in ICAP server with no preview

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Moti,

 

I had an example on my local git which also works with gzip and other stuff for BGU however I cannot find it now.

From what I remember this worked with POST but only like an external acl helper.

Ie blocking or allowing OK/ERR:

https://github.com/elico/drbl-icap-service

 

Any modification of the headers is a bit complicated.

 

I can try to check/test it but it will take time.

From what I see 5.0.4 is pretty stable however there are specific issues related to TLS 1.3.

 

Eliezer

 

----

Eliezer Croitoru

Tech Support

Mobile: +972-5-28704261

Email: ngtech1ltd@xxxxxxxxx

Zoom: Coming soon

 

 

From: squid-users <squid-users-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Moti Berger
Sent: Sunday, January 17, 2021 10:09 PM
To: squid-users@xxxxxxxxxxxxxxxxxxxxx
Subject: Adding headers in ICAP server with no preview

 

Hi

 

I have an environment with squid version 5.0.4 with ICAP server adapting requests by adding an header.

When I'm trying to send a POST request with a body I'm having an issue of a stuck connection.

What should the ICAP response look like?

 

What I do is to reply like this:

(dI./M..ICAP/1.0 200 OK
ISTag: "SjIzlRA4te41axxcDOoiSl6rBRg4ZK"
Date: Sun, 17 Jan 2021 19:34:12 GMT
Server: BaseICAP/1.0 Python/3.6.12
Encapsulated: req-hdr=0, req-body=360

POST http://www.dst-server.com:22222/v1/test HTTP/1.1
x-new-header: {"key": "value"}
user-agent: python-requests/2.25.1
accept-encoding: gzip, deflate
accept: */*
content-length: 16
content-type: application/json
host: www.dst-server.com:22222

 

 Please assume the number in req-body=360 is correct (I trimmed here the content of the new header).

As I said, I use 'Preview: 0' since I don't mind the body. The question is whether declaring the body starts at X (req-body=X) is OK even though I don't have a body to send? I think having req-null=X is bad since it probably tells squid that I decided the adapted request should have no body, but that's only a guess.

 

When the ICAP doesn't adapt the request, everything looks fine.

When it adapts the request I see that the POST request squid sends to www.dst-server.com doesn't contain the body.

 

On the logs of the server behind www.dst-server.com I see an entry for the API request only after I abort the request I sent.

 

I use python's requests module to make the request:

 

import requests
s = requests.Session()
s.proxies = {'http': 'localhost:8000', 'https': 'localhost:8000'} 

resp = s.post('http://www.dst-server.com:22222/v1/test', allow_redirects=False, json={'key': 'value'})

 

I'll highly appreciate any help.

Thanks,

Moti

_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux