Cadons / libtusclient

MIT License
2 stars 1 forks source link

Study the protocol and define the design #4

Closed Cadons closed 1 month ago

Cadons commented 2 months ago

Study the tus protocol, define the data structures, choose a server for testing The library must use std library as much as possible in order to be universal (qt, boost could also be used) Develop linux and macosx and windows version Website

it will be a dynamic library

Cadons commented 2 months ago

Libraries to use:

Cadons commented 2 months ago

use this for test server: docker pull tusproject/tusd

Cadons commented 2 months ago

POST /files HTTP/1.1 Host: tus.example.org Content-Length: 0 Content-Range: bytes */100 Content-Type: image/jpeg Content-Disposition: attachment; filename="cat.jpg"

[empty body]

Cadons commented 2 months ago

PUT /files/24e533e02ec3bc40c387f1a0e460e216 HTTP/1.1 Host: tus.example.org Content-Length: 100 Content-Range: bytes 0-99/100

[bytes 0-99]

Cadons commented 2 months ago

In this case, the upload succeeded. However, if there had been a network error during the PUT request, the client could have also resumed this upload:

Request:

HEAD /files/24e533e02ec3bc40c387f1a0e460e216 HTTP/1.1 Host: tus.example.org

[empty body]

Response:

HTTP/1.1 200 Ok Content-Length: 100 Content-Type: image/jpg Content-Disposition: attachment; filename="cat.jpg"' Range: bytes=0-69

[empty body]

The Range tells the client how much data made it to the server, so he can continue from there:

PUT /files/24e533e02ec3bc40c387f1a0e460e216 HTTP/1.1 Host: tus.example.org Content-Length: 30 Content-Range: bytes 70-99/100

[bytes 70-99]

Cadons commented 2 months ago

This library will support tus 1.0.0, but the priority is upload files, so it will start supporting tus 0.1/0.2 after this milestone it will updated in order to support also the other features of tus 1.0.0