svenstaro/miniserve

Is uploading text files (html, json, yaml...) supported?

ossfellow opened this issue · 2 comments

Hi,
I was trying to use miniserve to upload text files (specifically .txt and .yaml) and kept receiving Request did not meet this resource's requirements. error (http error 405).
Looking at the help it seems only certain media types (audio, video, image) are supported; is my understanding correct?

I used curl -vF "@./myfile.txt" https://myserverurl/upload\?path=\/ (miniserve uses TLS, is listening on port 443, and the upload folder is the same as its the serving folder).

The last part of http response (the error part) is:

We are completely uploaded and fine
Connection state changed (MAX_CONCURRENT_STREAMS == 4294967295)!
< HTTP/2 405
< content-length: 50
< content-type: text/plain; charset=utf-8
< date: Sun, 05 Feb 2023 20:04:46 GMT
<
Connection #0 to host myserverurl left intact
Request did not meet this resource's requirements

Thanks for your insight.

Oh, this is very weird. It should definitely support uploading of any type of file since it doesn't really care about the specific type of file. Do you have a test file I can reproduce this with?

My intent was/is to serve yaml files, and for testing, I initially used a simple small text file and then a k8s ConfigMap.

So, the testing conditions were as follows:

  • The upload was being initiated from a different computer (my laptop) than the server (RPi3) running miniserve.
  • I used http and https with the same results (I use https for downloads successfully).
  • I tried it with Curl’s -F and -d, but the result was exactly the same.

Thank you for looking into this.