Giter Club home page Giter Club logo

Comments (9)

WyriHaximus avatar WyriHaximus commented on May 22, 2024

ping @clue, could this possibly be in the SSL part of react/socket-client?

from http-client.

pwhelan avatar pwhelan commented on May 22, 2024

This also happens at the socket-client level, this is an example (without actually parsing the response to exit cleanly):

<?php

require_once 'vendor/autoload.php';

$url = "https://example.com";

$mp = new p3k\Multipart;
$mp->addPart('field', ''value');
$mp->addFile('photo', 'small-98kb.jpeg'', 'image/jpeg');

$loop = React\EventLoop\Factory::create();
$dnsFactory = new React\Dns\Resolver\Factory();
$dns = $dnsFactory->createCached('192.168.2.1', $loop);
$tcpConnector = new React\SocketClient\TcpConnector($loop);
$dnsConnector = new React\SocketClient\DnsConnector($tcpConnector, $dns);
$connector = new React\SocketClient\SecureConnector($dnsConnector, $loop, ['verify_peer' => false]);


$loop->nextTick(function() use ($connector, $url, $mp) {

    $urlparts = parse_url($url);

    $connector->create($urlparts['host'], 443)
        ->then(function (React\Stream\Stream $stream) use ($mp, $urlparts) {

            $stream->write(
                "POST {$urlparts['path']} HTTP/1.0\r\n" .
                "Host: {$urlparts['host']}\r\n" .
                "Content-Type: ".$mp->contentType()."\r\n" .
                "Content-Length: ".strlen($mp->data())."\r\n" .
                "Connection: close\r\n" .
                "\r\n" .
                $mp->data()
            );

            $stream->on('data', function($data) {
                print "DATA = \n{$data}\n";
            });

            $stream->on('close', function() {
                print "DONE\n";
            });

            //$stream->end();
        });

});

while (1) $loop->run();

from http-client.

pwhelan avatar pwhelan commented on May 22, 2024

I also tested it with a small file and it worked perfectly.

from http-client.

clue avatar clue commented on May 22, 2024

the connection simply hangs

Thanks for letting us know, but from the details you've posted, the problem appears to be a bit unclear to me. Perhaps you can elaborate: What exactly is hanging here, what is the expected behavior and how does the observed behavior differ?

There are many different possible sources of problems, perhaps this helps pinpointing this. Thanks!

Could we perhaps be running into HTTP's keepalive connection timeouts here?

from http-client.

clue avatar clue commented on May 22, 2024

Ping @pwhelan, and new info on this on?

from http-client.

pwhelan avatar pwhelan commented on May 22, 2024

I fixed it by using by own external micro service in golang to upload files via https. As far as I can tell no one else has followed up with the different issues to finally fix this. From what I can tell it seems to be a problem either in PHP itself or in the way it is handled by react socket client.

from http-client.

clue avatar clue commented on May 22, 2024

From what I can tell it seems to be a problem either in PHP itself or […]

Please provide us with some more details so we can look into this (see above). So far, nobody has managed to run into the issue you're seeing, so I'm not sure there's a problem in any of the mentioned components in the first place.

from http-client.

clue avatar clue commented on May 22, 2024

We still need some more information / confirmation here, but I suppose this may be related to reactphp/stream#64, which indicates this is a general issues with sending large chunks over a TLS connection.

from http-client.

clue avatar clue commented on May 22, 2024

We have managed to reproduce and pin point this to a bug in PHP that has recently been fixed in 7.1.4 and 7.0.18. We're planning to provide a work around for this for affected versions via reactphp/socket#105 👍

from http-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.