Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions module.combodo-webhook-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
//
SetupWebPage::AddModule(__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'combodo-webhook-integration/1.4.5',
'combodo-webhook-integration/1.4.4',
array(
//
'label' => 'Webhook integrations',
Expand Down Expand Up @@ -44,7 +44,14 @@

// Default settings
//
'settings' => array(),
'settings' => array(
// Configuración de proxy para las llamadas salientes de los webhooks
'proxy' => array(
'host' => 'ip.roxy:3128', // IP:PUERTO de tu proxy
'user' => '', // si no requiere auth, dejalo vacío
'password' => '',
)
)
)
);

Expand Down
32 changes: 32 additions & 0 deletions src/Service/WebRequestSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,37 @@ public function SendSynchronously(WebRequest $oRequest, &$aIssues, $oLog = null)
{
try
{
// ============================
// Inyectar opciones de proxy
// ============================
$oConfig = MetaModel::GetConfig();
$aProxyConf = $oConfig->GetModuleSetting('combodo-webhook-integration', 'proxy', null);

if (is_array($aProxyConf) && !empty($aProxyConf['host'])) {
// Recuperar opciones actuales del request (si no hay, iniciamos array vacío)
$aCurlOptions = $oRequest->GetOptions();
if (!is_array($aCurlOptions)) {
$aCurlOptions = array();
}

// Host:puerto del proxy
$aCurlOptions[CURLOPT_PROXY] = $aProxyConf['host'];
$aCurlOptions[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;

// Auth opcional si el proxy la requiere
if (!empty($aProxyConf['user'])) {
$sAuth = $aProxyConf['user'];
if (!empty($aProxyConf['password'])) {
$sAuth .= ':'.$aProxyConf['password'];
}
$aCurlOptions[CURLOPT_PROXYUSERPWD] = $sAuth;
}

// Guardar las opciones de vuelta en el request
$oRequest->SetOptions($aCurlOptions);
}
// ============================

$aResponseHeaders = array();
$sResponse = $this->DoPostRequest($oRequest->GetURL(), array(), null, $aResponseHeaders, $oRequest->GetOptions());

Expand Down Expand Up @@ -164,6 +195,7 @@ public function SendSynchronously(WebRequest $oRequest, &$aIssues, $oLog = null)
}
}


/**
* Add the $oRequest to the queue in order to be send later
*
Expand Down
Loading