Ticket #2875 (closed defect (bug): duplicate)

Opened 6 years ago

Last modified 4 years ago

https enclosures fail on post.

Reported by: nigelkane Owned by: anonymous
Priority: normal Milestone:
Component: General Version: 2.0.2
Severity: major Keywords: has-patch needs-testing
Cc:

Description

I was noticeing a problem in that when you post on a standard HTML site, enclosures get added into postmeta on publishing a post. When running off an HTTPS site, this no longer happens.

The reason is the regex only looks for HTTP. Line 1032 of wp-includes/functions.php

  preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp2);

Add the following under this line and it works.

  preg_match_all("{\b https : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp2);
  foreach($post_links_temp2[0] as $link) {
    $post_links_temp[0][] = $link;
  }

There may be a nicer way to regex that up, but I couldn't add it.

I have raised it as high/major because it is a bit of a hole that I cannot override the functionality of, and I use the RSS feed for podcasting - which WordPress does not support from an HTTPS site.

Attachments

2875.diff Download (1.2 KB) - added by Nazgul 5 years ago.

Change History

preg_match_all("{\b https? : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp2);

In regex, the question mark makes the previous item optional... so https? matches http or https

Thanks Mark... Regex is one of the last surviving dark arts :)

Having tested this fix a little more its not the only reason why podcasting won't work.

the do_enclose() function does not actually seem to get called when running from an HTTPS site. and even when you hack the enclosure custom tag in the post (with the correct values as well), itunes moans that there was a problem - quite possibly it does not like HTTPS because nothing gets populated in any of the fields.

The feed is identical in XML though.

Thought I had it for a moment there. But at least when you force the do_enclose() call it does populate the headers now :)

wp_html_headers() does not support ssl either.

at the current line 1073 the 2 lines setting the port should be re-writting:

        $scheme = "";
        if ( $parts['scheme'] == "https" )
                $scheme = "ssl://";
        if ( !isset( $parts['port'] ) ) {
                if($scheme) {
                        $parts['port'] = 443;
                } else {
                        $parts['port'] = 80;
                }
        }

You should not adjust the $host parameter as this is used in the HTML header commands and will break.

You then should add the scheme into the fsockopen command:

        $fp = @fsockopen($scheme.$host, $parts['port'], $err_num, $err_msg, 3);

Still working on why this particular section is not being called.

  • Keywords needs-patch added
  • Milestone set to 2.1

comment:5   matt5 years ago

  • Milestone changed from 2.1 to 2.2

Nazgul5 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone changed from 2.2 to 2.3

Added a patch based on the given code snippets.

I don't have a https site to test this on.

comment:7   ryan4 years ago

  • Milestone changed from 2.3 to 2.4 (next)
  • Priority changed from high to normal

See #4779, which implements this, but isn't used in this area.

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone 2.9 deleted

When #4779 is fully tested and implemented throughout WordPress it will obsolete this ticket. Closing now as duplicate.

Note: See TracTickets for help on using tickets.