We're working on building a multithreaded proxy file server in C, where we receive a request and retrieve it from another location using the libcurl library.
The library gives you the option of issuing a HEAD request to get some file parameters - such as size etc.
You can also get these parameters when you actually start serving the file.
A colleague has pointed out that doing a HEAD request and then immediately getting the file afterwards is wasteful. I agree with him, but I was wondering if there exists any use case where it might be useful to know the file size in advance?
- e.g. Choosing optimal MTU.
- e.g. Setting thread priority if it is a big file.
- e.g. Reducing overall threads in case we use up too much memory when we have a big file.
In addition to this are there security concerns when we query a file size before retrieving it in the proxy file server scenario?