When you check the option Accept invalid SSL certificates from an importer configuration form, the option is never considered.
In FeedsHTTPFetcher.inc file, you should pass the accept_invalid_cert configuration as an argument when function http_request_get_common_syndication() is called.
/**
* Override parent::sourceFormValidate().
*/
public function sourceFormValidate(&$values) {
$values['source'] = trim($values['source']);
// Keep a copy for error messages.
$original_url = $values['source'];
$parts = parse_url($values['source']);
if (empty($parts['scheme']) && $this->config['auto_scheme']) {
$values['source'] = $this->config['auto_scheme'] . '://' . $values['source'];
}
if (!feeds_valid_url($values['source'], TRUE)) {
$form_key = 'feeds][' . get_class($this) . '][source';
form_set_error($form_key, t('The URL %source is invalid.', array('%source' => $original_url)));
}
elseif ($this->config['auto_detect_feeds']) {
feeds_include_library('http_request.inc', 'http_request');
if ($url = http_request_get_common_syndication(
$values['source'],
array('accept_invalid_cert' => $this->config['accept_invalid_cert'])
)) {
$values['source'] = $url;
}
}
}
Comments
Comment #1
make77 commentedHere is a patch to fix this problem.
Comment #2
make77 commentedRename patch...
Comment #5
megachrizThe option "Accept invalid SSL certificates" is not totally ignored, see for example
FeedsHTTPFetcherResult::getRaw(), but fails to function when the option "Auto detect feeds" is enabled. An error like the following will occur:I applied the patch from #2 manually and I can confirm that there is no longer a cURL error when the "Auto detect feeds" option is also enabled. I tested this with using the URL "https://www.drupal.org/node" as input.
Attached is a reformatted patch, created using git. I also moved the function call out of the if statement as I think this improves the readability of the code.
Comment #6
make77 commented@MegaChriz, thank you for the explanation ! I created my patch using svn as my project at work uses svn... The documentation doesn't mention svn (https://www.drupal.org/patch/submit) so I suppose we should always use git to create compatible patches ?
Comment #7
megachriz@make77
There are other options for creating compatible patches (though I do not know them), but for drupal.org, creating patches using git is the recommended way. Important is that the patch is in the "p1" format, which automatically happens when creating a patch with the command "git diff".
Comment #8
megachrizComment #10
twistor commented