-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to configure squid server to operate with bitz-server properly. #9
Comments
Hey,
You should use bitz-server's request handlers as squid's method names.
Have a look into /etc/bitz/bitz-server.conf for request handlers names.
By default, REQMOD and RESPMOD for request and response modification handlers respectively.
Kind regards,
gr3m1in
|
@gr3m1in, Just to make sure I understand, according to the configuration file (bitz-server.conf) the modifier named is modpy, right ? However, it seems like it doesn't matter what I write in the squid configuration file (<method_name>), I keep getting the response handler from modpy. |
Not really. The |
@gr3m1in, so after I set squid configuration according to your guidelines, it seems to be working and I could use the passthrough module modpy.py which forward the request exactly as it is : resp_payload = {}; However, it seems like the squid server treat this response as erroneous and the reason was that we send the request headers in the response, as specified in function
After I commented out the send_data line above, it works and I could finally see the file received on the client side. Now I see that large files (>10kB) are not returned as whole, and I get the following message from curl on the client side "curl: (18) transfer closed with XXX bytes remaining to read" while opening gdb on the bitz worker process, I could definitely see that it's properly send the entire file in method I should say that it's not likely a network issue since without icap everything works just fine .. perhaps there's a timeout that I need to re-configure somewhere? BTW, I also tried to run with the --debug option and saw no sign of connection close. thanks ! |
I'm just guessing right now, but it looks to me as incorrect behaviour around ICAP "preview" feature... |
There is a timeout which you can disable conf/bitz-server.conf.in#L18. I see the issue with headers, |
I've released v2.0.2 which should fix the header issue (#10). @iradization, could you please give it a try? |
Hi @uditha-atukorala , I've tried to run with your latest fix. however, I get erroneous packet in my squid server. looking at the logs from squid, it seems like squid get the packet without res-hdr only res-body. here are the logs from squid : good packet (for comparison):
bad packet:
trying to debug it a little further, I've noticed that in method (gdb) p *response._header still trying to pinpoint the problem. |
@uditha-atukorala, I think that the problem might be in the following method : looks like data_length variable is not initialed properly. For example, in case we have only res_body and res_header, you can see that _encapsulated["res-hdr"] is set with 0 instead of the real section length. Let me know if what do you think. thanks ! |
@iradization, thanks for looking into this.
However, I did a quick few tests (using test/icap-client.py) it seems like the encapsulated header isn't getting set correctly (e.g. Got |
Released v2.0.3, should fix the encapsulated header issue (#12). |
@uditha-atukorala, I'm happy to report that indeed after the headers parts were sorted correctly, the problem resolved 👍 However, I tried to set the timeout as you informed me from the configuration file, and I still the sudden stopped stream when trying to download large files, of size bigger than ICAP_BUFFER_SIZE This problem seem to be connected to the way send_line works when sending the file in chunks from method send_chunked method in lib/icap.utils.cpp. I suspect that the suffix when I switched :
with :
it seems to do the job. |
@iradization, you are right. There needs to be a e.g.
However your change will need to make sure end of chuck is sent correctly as well (lib/icap/util.cpp#L383). Think it would be cleaner to keep the I'm happy to accept a pull requests if you want to contribute your changes. |
I'd also propose the following fix for the very last chunk with size less than ICAP_BUFFER_SIZE since the division here acts as floor() and the last such chunk is not being sent to client.
|
@gr3m1in, thanks for proposed fix. I'm happy to accept a pull request if you are up for it. (I'd also initialise chunks with 1 instead of 0 for completeness) |
@uditha-atukorala, of course I'll make a couple of pull requests with my changes later, once I manage to take my setup up and running, because some of the fixes may change in the meantime. |
Hi,
I'd like to configure bitz-server with squid proxy.
squid should have callback for response method like in the following example :
icap_service service_resp respmod_precache bypass=0 icap://192.168.50.1:1344/<method_name>
Anybody knows what to replace with the <method_name> ?
thanks
The text was updated successfully, but these errors were encountered: