Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
}
}
}
Comment | File | Size | Author |
---|---|---|---|
#5 | feeds-accept-invalid-cert-auto-detect-feeds-2419111-5.patch | 669 bytes | MegaChriz |
#2 | feeds-accept_invalid_cert_not_used-2419111-2.patch | 652 bytes | make77 |
#1 | feeds-accpet_invalid_cert_not_used-2419111-1.patch | 652 bytes | make77 |
Comments
Comment #1
make77 CreditAttribution: make77 commentedHere is a patch to fix this problem.
Comment #2
make77 CreditAttribution: make77 commentedRename patch...
Comment #5
MegaChriz CreditAttribution: MegaChriz commentedThe 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 CreditAttribution: 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 CreditAttribution: MegaChriz commented@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
MegaChriz CreditAttribution: MegaChriz commentedComment #10
twistor CreditAttribution: twistor commented