netom / pyicap

A lightweight python framework for writing ICAP services
Other
105 stars 52 forks source link

Connection reset by peer on respmod_copy.py #31

Open scardine opened 6 years ago

scardine commented 6 years ago

I'm trying respmod_copy.py and getting this:

127.0.0.1 - - [12/Mar/2018 17:47:42] "RESPMOD icap://127.0.0.1:13440/example ICAP/1.0" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52708)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/SocketServer.py", line 593, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib64/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/site-packages/pyicap.py", line 442, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/site-packages/pyicap.py", line 476, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/usr/lib64/python2.7/socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer
----------------------------------------
127.0.0.1 - - [12/Mar/2018 17:47:54] "RESPMOD icap://127.0.0.1:13440/example ICAP/1.0" 200 -

Environment information:

$ python --version
Python 2.7.5

$ squid -v
Squid Cache: Version 3.5.20
Service Name: squid
configure options:  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-strict-error-checking' '--exec_prefix=/usr' '--libexecdir=/usr/lib64/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--sysconfdir=/etc/squid' '--with-logdir=$(localstatedir)/log/squid' '--with-pidfile=$(localstatedir)/run/squid.pid' '--disable-dependency-tracking' '--enable-eui' '--enable-follow-x-forwarded-for' '--enable-auth' '--enable-auth-basic=DB,LDAP,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB,SMB_LM,getpwnam' '--enable-auth-ntlm=smb_lm,fake' '--enable-auth-digest=file,LDAP,eDirectory' '--enable-auth-negotiate=kerberos' '--enable-external-acl-helpers=file_userip,LDAP_group,time_quota,session,unix_group,wbinfo_group' '--enable-cache-digests' '--enable-cachemgr-hostname=localhost' '--enable-delay-pools' '--enable-epoll' '--enable-ident-lookups' '--enable-linux-netfilter' '--enable-removal-policies=heap,lru' '--enable-snmp' '--enable-ssl-crtd' '--enable-storeio=aufs,diskd,rock,ufs' '--enable-wccpv2' '--enable-esi' '--enable-ecap' '--with-aio' '--with-default-user=squid' '--with-dl' '--with-openssl' '--with-pthreads' '--disable-arch-native' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fpie' 'LDFLAGS=-Wl,-z,relro  -pie -Wl,-z,relro -Wl,-z,now' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fpie' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core)
Release:        7.4.1708
Codename:       Core

Configuration:

icap_enable on

icap_service service_resp respmod_precache bypass=0 icap://127.0.0.1:13440/example
adaptation_access service_resp allow SSL_ports

My goal is to change resource URLs from http to https in the response body.

LeonardoNve commented 5 years ago

I have the same problem.

My squid version is 4.4

Config: icap_enable on icap_service my_service respmod_precache icap://127.0.0.1:13440/example adaptation_access my_service allow all

hazelement commented 5 years ago

I'm having the same issue...

LeonardoNve commented 4 years ago

Same issue

davegermiquet commented 4 years ago

This should be a good example, with squid configuration:

https://github.com/davegermiquet/icap_server_v2

Most web sites are working however I'm having problems with 2 factor on www.fastmail.com

davegermiquet commented 4 years ago

I have the same problem.

My squid version is 4.4

Config: icap_enable on icap_service my_service respmod_precache icap://127.0.0.1:13440/example adaptation_access my_service allow all

I believe its a problem in the handle_one_request function and you might need to modify the parse_request option. See my repository for the overridden functions.

stavrakis commented 3 years ago

Is this fixed? I'm having the same problem.

aes3219563 commented 3 years ago

the same issue. Any suggestions?