[wp-trac] [WordPress Trac] #46559: Could not embed some content

WordPress Trac noreply at wordpress.org
Sun Mar 31 14:53:30 UTC 2019


#46559: Could not embed some content
--------------------------+-----------------------
 Reporter:  Krstarica     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:
Component:  Embeds        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------
Changes (by Krstarica):

 * status:  closed => reopened
 * resolution:  worksforme =>


Comment:

 Hi @desrosj,

 I've debugged the issue and found two causes.

 1) Getting http_request_failed due to cURL error 28: Operation timed out
 after 5000 milliseconds with 2594 out of 2818 bytes received error.

 WordPress uses the following code in wp-
 includes/Requests/Transport/cURL.php:
 {{{
 ...
 curl_setopt($this->handle, CURLOPT_ENCODING, '');
 ...
 curl_setopt($this->handle, CURLOPT_BUFFERSIZE, Requests::BUFFER_SIZE);
 }}}

 Combination of above parameters triggers timeouts fetching some URLs like
 the one reported using cURL version 7.29.0. This is rather old cURL, but
 it is bundled with CentOS 7.6.

 Workaround is to comment out line:
 {{{
 curl_setopt($this->handle, CURLOPT_ENCODING, '');
 }}}
 but the problem sometimes still happens, although less frequently.

 Upgraded to cURL 7.64.1 and things are slightly faster, but didn't resolve
 the issue completely.


 2) Instagram oEmbed API redirects several times:

 {{{
 wget
 "https://api.instagram.com/oembed?maxwidth=696&maxheight=1000&url=https%3A%2F%2Fwww.instagram.com%2Fp%2FBvmdPLyBFjh%2F&dnt=1&format=json"
 --2019-03-31 16:16:04--
 https://api.instagram.com/oembed?maxwidth=696&maxheight=1000&url=https%3A%2F%2Fwww.instagram.com%2Fp%2FBvmdPLyBFjh%2F&dnt=1&format=json
 Resolving api.instagram.com (api.instagram.com)... 31.13.64.52,
 2a03:2880:f206:c4:face:b00c:0:43fe
 Connecting to api.instagram.com (api.instagram.com)|31.13.64.52|:443...
 connected.
 HTTP request sent, awaiting response... 301 Moved Permanently
 Location:
 https://api.instagram.com/publicapi/oembed/?maxwidth=696&maxheight=1000&url=https%3A%2F%2Fwww.instagram.com%2Fp%2FBvmdPLyBFjh%2F&dnt=1&format=json
 [following]
 --2019-03-31 16:16:04--
 https://api.instagram.com/publicapi/oembed/?maxwidth=696&maxheight=1000&url=https%3A%2F%2Fwww.instagram.com%2Fp%2FBvmdPLyBFjh%2F&dnt=1&format=json
 Reusing existing connection to api.instagram.com:443.
 HTTP request sent, awaiting response... 302 Found
 Location:
 https://www.instagram.com/publicapi/oembed/?maxwidth=696&maxheight=1000&url=https://www.instagram.com/p/BvmdPLyBFjh/&dnt=1&format=json
 [following]
 --2019-03-31 16:16:04--
 https://www.instagram.com/publicapi/oembed/?maxwidth=696&maxheight=1000&url=https://www.instagram.com/p/BvmdPLyBFjh/&dnt=1&format=json
 Resolving www.instagram.com (www.instagram.com)... 31.13.91.174,
 2a03:2880:f21b:e5:face:b00c:0:4420
 Connecting to www.instagram.com (www.instagram.com)|31.13.91.174|:443...
 connected.
 HTTP request sent, awaiting response... 302 Found
 Location:
 https://api.instagram.com/oembed/?maxwidth=696&maxheight=1000&url=https://www.instagram.com/p/BvmdPLyBFjh/&dnt=1&format=json
 [following]
 --2019-03-31 16:16:04--
 https://api.instagram.com/oembed/?maxwidth=696&maxheight=1000&url=https://www.instagram.com/p/BvmdPLyBFjh/&dnt=1&format=json
 Connecting to api.instagram.com (api.instagram.com)|31.13.64.52|:443...
 connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 8772 (8.6K) [application/json]
 Saving to:
 ‘oembed?maxwidth=696&maxheight=1000&url=https:%2F%2Fwww.instagram.com%2Fp%2FBvmdPLyBFjh%2F&dnt=1&format=json’
 }}}

 Not sure is it possible to update something in the core to fix
 redirection.

 Or at least
 {{{
 curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, true);
 }}}
 could be used for embeds, to avoid calling function
 Requests_Transport::request every time.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46559#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list