Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
2f139f95
Unverified
Commit
2f139f95
authored
7 years ago
by
Andreas Gohr
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2244 from peterdd/patch-1
move class DokuHTTPClient behind HTTPClient
parents
f692b0aa
feea8cb6
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
inc/HTTPClient.php
+71
-71
71 additions, 71 deletions
inc/HTTPClient.php
with
71 additions
and
71 deletions
inc/HTTPClient.php
+
71
−
71
View file @
2f139f95
...
...
@@ -9,77 +9,6 @@
define
(
'HTTP_NL'
,
"
\r\n
"
);
/**
* Adds DokuWiki specific configs to the HTTP client
*
* @author Andreas Goetz <cpuidle@gmx.de>
*/
class
DokuHTTPClient
extends
HTTPClient
{
/**
* Constructor.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
__construct
(){
global
$conf
;
// call parent constructor
parent
::
__construct
();
// set some values from the config
$this
->
proxy_host
=
$conf
[
'proxy'
][
'host'
];
$this
->
proxy_port
=
$conf
[
'proxy'
][
'port'
];
$this
->
proxy_user
=
$conf
[
'proxy'
][
'user'
];
$this
->
proxy_pass
=
conf_decodeString
(
$conf
[
'proxy'
][
'pass'
]);
$this
->
proxy_ssl
=
$conf
[
'proxy'
][
'ssl'
];
$this
->
proxy_except
=
$conf
[
'proxy'
][
'except'
];
// allow enabling debugging via URL parameter (if debugging allowed)
if
(
$conf
[
'allowdebug'
])
{
if
(
isset
(
$_REQUEST
[
'httpdebug'
])
||
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
&&
strpos
(
$_SERVER
[
'HTTP_REFERER'
],
'httpdebug'
)
!==
false
)
)
{
$this
->
debug
=
true
;
}
}
}
/**
* Wraps an event around the parent function
*
* @triggers HTTPCLIENT_REQUEST_SEND
* @author Andreas Gohr <andi@splitbrain.org>
*/
/**
* @param string $url
* @param string|array $data the post data either as array or raw data
* @param string $method
* @return bool
*/
function
sendRequest
(
$url
,
$data
=
''
,
$method
=
'GET'
){
$httpdata
=
array
(
'url'
=>
$url
,
'data'
=>
$data
,
'method'
=>
$method
);
$evt
=
new
Doku_Event
(
'HTTPCLIENT_REQUEST_SEND'
,
$httpdata
);
if
(
$evt
->
advise_before
()){
$url
=
$httpdata
[
'url'
];
$data
=
$httpdata
[
'data'
];
$method
=
$httpdata
[
'method'
];
}
$evt
->
advise_after
();
unset
(
$evt
);
return
parent
::
sendRequest
(
$url
,
$data
,
$method
);
}
}
/**
* Class HTTPClientException
*/
...
...
@@ -938,4 +867,75 @@ class HTTPClient {
}
}
/**
* Adds DokuWiki specific configs to the HTTP client
*
* @author Andreas Goetz <cpuidle@gmx.de>
*/
class
DokuHTTPClient
extends
HTTPClient
{
/**
* Constructor.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
__construct
(){
global
$conf
;
// call parent constructor
parent
::
__construct
();
// set some values from the config
$this
->
proxy_host
=
$conf
[
'proxy'
][
'host'
];
$this
->
proxy_port
=
$conf
[
'proxy'
][
'port'
];
$this
->
proxy_user
=
$conf
[
'proxy'
][
'user'
];
$this
->
proxy_pass
=
conf_decodeString
(
$conf
[
'proxy'
][
'pass'
]);
$this
->
proxy_ssl
=
$conf
[
'proxy'
][
'ssl'
];
$this
->
proxy_except
=
$conf
[
'proxy'
][
'except'
];
// allow enabling debugging via URL parameter (if debugging allowed)
if
(
$conf
[
'allowdebug'
])
{
if
(
isset
(
$_REQUEST
[
'httpdebug'
])
||
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
&&
strpos
(
$_SERVER
[
'HTTP_REFERER'
],
'httpdebug'
)
!==
false
)
)
{
$this
->
debug
=
true
;
}
}
}
/**
* Wraps an event around the parent function
*
* @triggers HTTPCLIENT_REQUEST_SEND
* @author Andreas Gohr <andi@splitbrain.org>
*/
/**
* @param string $url
* @param string|array $data the post data either as array or raw data
* @param string $method
* @return bool
*/
function
sendRequest
(
$url
,
$data
=
''
,
$method
=
'GET'
){
$httpdata
=
array
(
'url'
=>
$url
,
'data'
=>
$data
,
'method'
=>
$method
);
$evt
=
new
Doku_Event
(
'HTTPCLIENT_REQUEST_SEND'
,
$httpdata
);
if
(
$evt
->
advise_before
()){
$url
=
$httpdata
[
'url'
];
$data
=
$httpdata
[
'data'
];
$method
=
$httpdata
[
'method'
];
}
$evt
->
advise_after
();
unset
(
$evt
);
return
parent
::
sendRequest
(
$url
,
$data
,
$method
);
}
}
//Setup VIM: ex: et ts=4 :
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