Shenal Silva Shenal Silva - 5 months ago 13
HTTP Question

How to get the filename from HTTP GET request

I am trying to add a modification to Axel to get the proper filename this should be done in C language.

Currently a link such as would be saved under the filename 49667352 therfore

However when downloading from the webbrowser or a download manager such as IDM it captures the filename such as movie.mp4 sent from the server after the first Get request. How can I add that implemenation with C language.


In such cases, in the response that comes from the server, there is a header called Content-Disposition. Value of this header holds some info about the file being downloaded. So, you can find the file name in this header.

An example of this header:

Content-Disposition : attachment; "movie.mp4"