Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
liu-puppet-modules
aes
Commits
b88755b3
Commit
b88755b3
authored
5 years ago
by
Klas Arvidsson
Browse files
Options
Downloads
Patches
Plain Diff
squid filter program update
parent
59cebc2c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/squid/helpers/squid-url-rewrite.py
+8
-5
8 additions, 5 deletions
files/squid/helpers/squid-url-rewrite.py
with
8 additions
and
5 deletions
files/squid/helpers/squid-url-rewrite.py
+
8
−
5
View file @
b88755b3
...
@@ -14,15 +14,18 @@ hostname = socket.gethostname()
...
@@ -14,15 +14,18 @@ hostname = socket.gethostname()
def
block_response
(
url
):
def
block_response
(
url
):
quoted_url
=
urllib
.
parse
.
quote
(
url
)
quoted_url
=
urllib
.
parse
.
quote
(
url
)
if
re
.
match
(
'
.*\.s?html([#?].*)?
'
,
url
):
if
re
.
match
(
'
.*\.s?html([#?].*)?
'
,
url
)
or
re
.
match
(
'
.*/[^./]*
'
,
url
):
return
'
OK status=307 url=
"
{}?requested={}
"'
.
format
(
errorpage
,
quoted_url
)
return
'
OK status=307 url=
"
{}?requested={}
"'
.
format
(
errorpage
,
quoted_url
)
else
:
else
:
return
'
OK status=307 url=
"
{}
"'
.
format
(
emptypage
)
return
'
OK status=307 url=
"
{}
"'
.
format
(
emptypage
)
# return "OK status=302 url=\"" + errorpage + "\""
# Note:
# "status" can only be used in the "Using an HTTP redirector" case,
# With a redirector squid ask the client to fetch another page.
# not in the "Using a re-writer to mangle the URL as it passes" case
# With a re-writer squid ask the web server to fetch the new page.
# RTFM: https://wiki.squid-cache.org/Features/Redirectors
# "status" can only be used in the "Using an HTTP redirector" case,
# not in the "Using a re-writer to mangle the URL as it passes" case.
# See:
# https://wiki.squid-cache.org/Features/Redirectors
def
modify_url
(
line
,
ruleset
):
def
modify_url
(
line
,
ruleset
):
### [channel-ID <SP>] URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kv-pairs]<NL>
### [channel-ID <SP>] URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kv-pairs]<NL>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment