Make WordPress Core

Opened 7 years ago

Closed 2 years ago

#9072 closed enhancement (maybelater)

New Socket HTTP transport to use stream_socket_client

Reported by: jacobsantos Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: HTTP API Keywords: has-patch needs-testing
Focuses: Cc:


Steams use of stream_socket_client:

  • Support SSL.
  • Better support for non-blocking.
  • Damn sexy.

Attachments (2)

9072.diff (2.4 KB) - added by jacobsantos 7 years ago.
Uses stream_socket_client instead of fopen.
9072.patch (11.6 KB) - added by jacobsantos 5 years ago.
Tested and working patch for Sockets. Will need a bit more testing, but it does handle requests and appears to work fine.

Download all attachments as: .zip

Change History (22)

@jacobsantos7 years ago

Uses stream_socket_client instead of fopen.

comment:1 @jacobsantos7 years ago

  • Keywords has-patch needs-testing added

Needs crazy amount of testing.

comment:2 @westi7 years ago

  • Cc westi added

Good work Jacob :-)

comment:3 @beaulebens7 years ago

All of the *-streams.php tests in your http-tests suite fail for me now, and I get the following error when viewing them individually:

HTTP socket error 47731900: Unable to find the socket transport "http" - did you forget to enable it when you configured PHP? for http://localhost/

Even though I've got these showing in phpinfo()

Registered PHP Streams => zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps  
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls

and PHP claims "Streams are an integral part of PHP as of version 4.3.0. No steps are required to enable them."


comment:4 @jacobsantos7 years ago

  • Keywords needs-patch added; has-patch removed

comment:5 @jacobsantos7 years ago

See the problem is that we are doing Streams not Sockets. In which case, the https, should work for SSL. That we need to use Sockets for SSL is a problem.

comment:6 @Denis-de-Bernardy6 years ago

future? or is anyone volunteering to get this into 2.8?

comment:7 @Denis-de-Bernardy6 years ago

  • Milestone changed from 2.8 to Future Release

comment:8 @Denis-de-Bernardy6 years ago

  • Milestone changed from Future Release to 2.9

comment:9 follow-up: @Denis-de-Bernardy6 years ago

  • Milestone changed from 2.9 to Future Release

stream_socket_client is php5...

comment:10 in reply to: ↑ 9 @jacobsantos5 years ago

Replying to Denis-de-Bernardy:

stream_socket_client is php5...

The class itself is for PHP5, so it doesn't really matter. I did some research a while back and this is the recommended way to do this since it also supports non-blocking requests, which would be good to have.

I'm not sure what my interest is on this. I'll be doing some more work on the HTTP API, but the work may not include this work. That said, the non-blocking might be better to implement for what I'm wanting the HTTP API to do.

comment:11 @jacobsantos5 years ago

  • Owner set to jacobsantos
  • Status changed from new to accepted

comment:12 @jacobsantos5 years ago

I'm going to accept it for now. If not, then I'll just change the status back to new.

comment:13 @jacobsantos5 years ago

Basically, it is handled more like a socket than it is a stream. Therefore working with it is more like fsockopen than fopen with context. I'm almost done, but it is going to require a lot of testing.

@jacobsantos5 years ago

Tested and working patch for Sockets. Will need a bit more testing, but it does handle requests and appears to work fine.

comment:14 @jacobsantos5 years ago

New patch for testing.

comment:15 @jacobsantos5 years ago

  • Summary changed from Convert Streams HTTP transport to use stream_socket_client for SSL and whatever to New Socket HTTP transport to use stream_socket_client

comment:16 @jacobsantos5 years ago

  • Keywords has-patch added; needs-patch removed

comment:17 @jacobsantos3 years ago

  • Owner jacobsantos deleted
  • Status changed from accepted to assigned

comment:18 @jacobsantos3 years ago

  • Cc wordpress@… added

comment:19 @jacobsantos3 years ago

  • Cc wordpress@… removed

comment:20 @dd322 years ago

  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from assigned to closed

Ticket has been dormant for years, The patch is significantly out of date, and we have no intentions of adding an extra transport to support to the API right now.
If a need arrises we can resurrect this ticket.

Note: See TracTickets for help on using tickets.