-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Coming from thekid/dialog#8 (comment), while uploading via curl works, it doesn't when using this library.
Test script
use io\File;
use lang\Throwable;
use util\cmd\Console;
use webservices\rest\{Endpoint, RestUpload};
$api= new Endpoint($argv[2]);
$transfer= new File($argv[1]);
$target= 'target.mp4';
// Test code
Console::writeLine('Upload ', $transfer, ' ', $transfer->size());
$upload= new RestUpload($api, $api
->resource('images/{0}', [$target])
->request('PUT')
->waiting(read: 3600)
);
try {
foreach (['video' => $transfer] as $kind => $file) {
$upload->transfer($kind, $file->in(), $target);
}
$r= $upload->finish();
Console::writeLine('-> ', $r);
} catch (Throwable $t) {
$t->printStackTrace();
}We also have debug output in webservices.rest.RestUpload::transfer() to show progress!
Results
$ xp upload.script.php huge-file.mp4 https://tests.example.com/
Upload io.File(uri= C:\Tools\Cygwin\home\timmf\devel\huge-file.mp4, mode= rb) 13801052
BEGIN target.mp4 [
<21:24:18>...............
<21:24:19>...............
<21:24:20>..............
<21:24:21>..........
<21:24:22>................
<21:24:23>............
<21:24:24>..............
<21:24:25>...............
<21:24:26>..............
<21:24:27>...............
<21:24:28>..............
<21:24:29>.........
<21:24:30>....................
<21:24:31>..............
<21:24:32>..............
<21:24:33>.........
<21:24:34>...............
<21:24:35>..............
<21:24:36>...............
<21:24:37>........
<21:24:38>....................
<21:24:39>...............
<21:24:40>..............
<21:24:41>...............
<21:24:42>.............
<21:24:43>............
<21:24:44>..............
<21:24:45>..............
<21:24:46>...............
<21:24:47>..............
<21:24:48>......................................................................... (1200 more dots)
]
Exception webservices.rest.RestException (Cannot send request)
at <main>::fputs() [line 358 of Socket.class.php] fputs(): SSL: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen (... 1258 more)
at <main>::fputs() [line 358 of Socket.class.php] fputs(): SSL operation failed with code 1. OpenSSL Error messages:
error:1409E10F:SSL routines:ssl3_write_bytes:bad length (... 1 more)
at <main>::fread() [line 314 of Socket.class.php] fread(): SSL: Der Vorgang wurde erfolgreich beendet
at webservices.rest.Endpoint::finish(webservices.rest.io.Transmission{}) [line 92 of RestUpload.class.php]
at webservices.rest.RestUpload::finish() [line 23 of upload.script.php]
at <main>::include((0x11)'upload.script.php') [line 163 of Code.class.php]
at xp.runtime.Code::run(array[3]) [line 31 of Evaluate.class.php]
at xp.runtime.Evaluate::main(array[3]) [line 389 of class-main.php]
Caused by Exception lang.FormatException ("" is not a valid HTTP response [-1])
at <main>::fputs() [line 358 of Socket.class.php] fputs(): SSL: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen (... 1258 more)
at <main>::fputs() [line 358 of Socket.class.php] fputs(): SSL operation failed with code 1. OpenSSL Error messages:
error:1409E10F:SSL routines:ssl3_write_bytes:bad length (... 1 more)
at <main>::fread() [line 314 of Socket.class.php] fread(): SSL: Der Vorgang wurde erfolgreich beendet
at peer.http.HttpResponse::readHeader() [line 37 of HttpResponse.class.php]
at peer.http.HttpResponse::__construct(peer.SocketInputStream{}) [line 125 of SocketHttpTransport.class.php]
at peer.http.SocketHttpTransport::finish(peer.http.ChunkedHttpOutputStream{}) [line 148 of HttpConnection.class.php]
at peer.http.HttpConnection::finish(peer.http.ChunkedHttpOutputStream{}) [line 54 of Transmission.class.php]
... 6 more👉 after 30 seconds, things begin failing, fputs() doesn't return false but raises all these 1259 SSL: Eine bestehende Verbindung wurde softwaregesteuert durch den Hostcomputer abgebrochen warnings.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working