Tus Protocol Extensions

Hi,

I’m trying to get tusd server to respond with the Tus-Extension response by sending an OPTIONS header to the server via curl:

  curl -v -X POST https://tusd.tusdemo.net -H "OPTIONS: /files HTTP/1.1"
  
  response:
  
  ```
  
  *   Trying 3.226.182.14:443...
  * Connected to tusd.tusdemo.net (3.226.182.14) port 443 (#0)
  * ALPN: offers h2,http/1.1
  * (304) (OUT), TLS handshake, Client hello (1):
  *  CAfile: /etc/ssl/cert.pem
  *  CApath: none
  * (304) (IN), TLS handshake, Server hello (2):
  * (304) (IN), TLS handshake, Unknown (8):
  * (304) (IN), TLS handshake, Certificate (11):
  * (304) (IN), TLS handshake, CERT verify (15):
  * (304) (IN), TLS handshake, Finished (20):
  * (304) (OUT), TLS handshake, Finished (20):
  * SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
  * ALPN: server did not agree on a protocol. Uses default.
  * Server certificate:
  *  subject: CN=tusd.tusdemo.net
  *  start date: May 14 03:17:10 2023 GMT
  *  expire date: Aug 12 03:17:09 2023 GMT
  *  subjectAltName: host "tusd.tusdemo.net" matched cert's "tusd.tusdemo.net"
  *  issuer: C=US; O=Let's Encrypt; CN=R3
  *  SSL certificate verify ok.
  * using HTTP/1.x
  > POST / HTTP/1.1
  > Host: tusd.tusdemo.net
  > User-Agent: curl/7.88.1
  > Accept: */*
  > OPTIONS: /files HTTP/1.1
  > 
  < HTTP/1.1 200 OK
  < Server: Cowboy
  < Connection: keep-alive
  < Date: Fri, 07 Jul 2023 16:08:53 GMT
  < Content-Length: 670
  < Content-Type: text/plain; charset=utf-8
  < Via: 1.1 vegur
  < 
  Welcome to tusd
  ===============
  
  Congratulations on setting up tusd! Thanks for joining our cause, you have taken
  the first step towards making the future of resumable uploading a reality! We
  hope you are as excited about this as we are!
  
  While you did an awesome job on getting tusd running, this is just the welcome
  message, so let's talk about the places that really matter:
  
  - /files/ - send your tus uploads to this endpoint
  - /metrics - gather statistics to keep tusd running smoothly
  - https://github.com/tus/tusd/issues - report your bugs here
  
  So quit lollygagging, send over your files and experience the future!
  
  Version = n/a
  GitCommit = n/a
  BuildDate = n/a
  * Connection #0 to host tusd.tusdemo.net left intact
  ```

No Tus-Extension response header. I see similar results from my own version of tusd running on my system.

Question: How do I get the server to respond with Tus-Extension so I can determine which protocol extensions are supported?

Thanks,
Roy

Hi Roy,

OPTIONS is not a request header but the request method, which you can specify using -X OPTIONS. The correct command would be:

$ curl -X OPTIONS -v -H 'Tus-Resumable: 1.0.0' https://tusd.tusdemo.net/files/
*   Trying 54.237.159.171:443...
* Connected to tusd.tusdemo.net (54.237.159.171) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Client hello (1):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Server hello (2):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Unknown (8):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Certificate (11):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, CERT verify (15):
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Finished (20):
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: CN=tusd.tusdemo.net
*  start date: May 14 03:17:10 2023 GMT
*  expire date: Aug 12 03:17:09 2023 GMT
*  subjectAltName: host "tusd.tusdemo.net" matched cert's "tusd.tusdemo.net"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
> OPTIONS /files/ HTTP/1.1
> Host: tusd.tusdemo.net
> User-Agent: curl/7.87.0
> Accept: */*
> Tus-Resumable: 1.0.0
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: Cowboy
< Connection: keep-alive
< Tus-Extension: creation,creation-with-upload,termination,concatenation,creation-defer-length
< Tus-Max-Size: 128849018880
< Tus-Resumable: 1.0.0
< Tus-Version: 1.0.0
< X-Content-Type-Options: nosniff
< Date: Sat, 08 Jul 2023 15:54:07 GMT
< Content-Length: 0
< Via: 1.1 vegur
<
* Connection #0 to host tusd.tusdemo.net left intact

I hope this helps!

Thanks Marius, I was confused!