Shenal Silva Shenal Silva - 1 year ago 99
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.

Answer Source

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"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download