I am generating a file for download using a CGI function. I found that you can set the file name of the download by modifying the response header. See:
However, according to this thread:
you can no longer manually modify the header.
I'm thinking of modifying he HTTP server code if worst comes to worst, but is there a cleaner way of achieving what I want to do?
Similarly as in thread you mentioned you can use HTML tag <meta http-equiv> see: how to use | Instructions how to use c - meta tags seo search engines for further information. In your case it would be something like: <meta name="content-disposition" content="attachement; filename=myfilename.ext">
Thanks for the reply, but I don't like the idea of using meta tags for this purpose - I will probably try it at some point and see but further googling doesn't paint a good picture for the portability (or even functionality) of this approach. Most people who ask this question are told to use the actual HTTP headers. See here:
Any way I could get a feature request in for this? Maybe if enough people want it, it may happen...
Meanwhile, I put an "extra header" string pointer into the response struct and modified the code that builds the HTTP header accordingly. It ends up being 6 extra lines of code in 4 files which isn't too bad IMO (for a quick hack, anyway). The server code is pretty straightforward in those places. Hopefully I don't need to modify other stuff like this, could get messy...
The only scary part of this was not knowing 100% if the size of the response struct was hardcoded anywhere (which could break things pretty badly)... I'm choosing to assume that such code won't pass any review at Freescale, so that shouldn't be a problem.
I will create a task in our ticket system to allow custom header fields in CGI. As you mentioned it should not be that hard to implement, but it involves change of API (not so good). I will see what I can do.
Thank you. I understand the difficulties with API changes. Hopefully it would be easier than usual because something similar was apparently there before, looks like it just got pruned during cleanup/refactoring. In any case, it doesn't hurt for me to ask.