Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
Proxy
Commits
cbe92756
Commit
cbe92756
authored
8 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
Kleinere Bugfixes
parent
ac88c373
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Document.php
+4
-0
4 additions, 0 deletions
app/Document.php
app/HtmlDocument.php
+17
-5
17 additions, 5 deletions
app/HtmlDocument.php
app/Http/Controllers/ProxyController.php
+1
-0
1 addition, 0 deletions
app/Http/Controllers/ProxyController.php
with
22 additions
and
5 deletions
app/Document.php
+
4
−
0
View file @
cbe92756
...
...
@@ -106,6 +106,10 @@ abstract class Document
$abs
.
=
'@'
;
}
if
(
!
isset
(
$host
))
{
#die(var_dump($this->baseUrl));
}
$abs
.
=
$host
;
/* did somebody sneak in a port? */
if
(
isset
(
$port
))
{
...
...
This diff is collapsed.
Click to expand it.
app/HtmlDocument.php
+
17
−
5
View file @
cbe92756
...
...
@@ -36,11 +36,13 @@ class HtmlDocument extends Document
$dom
->
loadHtml
(
$this
->
htmlString
);
foreach
(
$dom
->
getElementsByTagName
(
'base'
)
as
$base
)
{
$href
=
$base
->
getAttribute
(
'href'
);
# Convert all relative Links to absolute Ones
$href
=
$this
->
convertRelativeToAbsoluteLink
(
$href
);
$this
->
baseUrl
=
$href
;
# Delete Base Tag
if
(
$base
->
hasAttribute
(
"href"
))
{
$href
=
$base
->
getAttribute
(
'href'
);
# Convert all relative Links to absolute Ones
$href
=
$this
->
convertRelativeToAbsoluteLink
(
$href
);
$this
->
baseUrl
=
$href
;
# Delete Base Tag
}
$base
->
parentNode
->
removeChild
(
$base
);
}
...
...
@@ -290,6 +292,16 @@ class HtmlDocument extends Document
$cssElement
->
proxifyContent
();
$el
->
setAttribute
(
"style"
,
$cssElement
->
getResult
());
}
# Some old sites might use the background attribute Let's parse them, too
if
(
$el
->
hasAttribute
(
"background"
))
{
# Convert all relative Links to absolute Ones
$el
->
setAttribute
(
"background"
,
$this
->
convertRelativeToAbsoluteLink
(
$el
->
getAttribute
(
"background"
)));
# Convert all Links to the proxified Version
# All of this Links should NOT target to the top Level
$el
->
setAttribute
(
"background"
,
$this
->
proxifyUrl
(
$el
->
getAttribute
(
"background"
),
false
));
}
# We Will Remove all Javascript Event attributes
# To keep things simple we're gonna remove all Attributes which names start with "on"
foreach
(
$el
->
attributes
as
$attr
)
{
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/ProxyController.php
+
1
−
0
View file @
cbe92756
...
...
@@ -153,6 +153,7 @@ class ProxyController extends Controller
$httpcode
=
$result
[
"http_code"
];
extract
(
parse_url
(
$targetUrl
));
$base
=
$scheme
.
"://"
.
$host
;
# We will parse whether we have a parser for this document type.
...
...
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