This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-TCPnet Webserver: Edit HTTP Header

Hi,

I am trying to edit the HTTP Header to change the "Content-Disposition" to "Attachment" to force a "Save As" to Download a XML-File (cgx-File).

So far i just found the function: cgx_content_type:

www.keil.com/.../rlarm_cgx_content_type.htm

I have tried to edit this function like this:

U8 *cgx_content_type (void)
{
  return( "Content-disposition: attachment; filename=fname.ext\r\n" );
}

This works for IE (maybe incorrectly) but doesn't work for Firefox. I think the reason is that this function can only edit the "Content-Type" and not the "content-Disposition".

The Answer Header watched in Firebug looks like this and has no entry for "Content-Disposition" instead overwrites the "Content-Type":

Server          Keil-EWEB/2.1
Content-Type    Content-disposition: attachment; filename=fname.ext
Cache-Control   no-cache
Connection      close

Normally it should be like this (example from greenbytes.de/.../):

Date                    Fri, 16 Dec 2011 08:37:15 GMT
Server                  Apache/2.2.14 (Ubuntu)
Cache-Control           no-cache
Content-Disposition     attachment; filename="foo.html"
Content-Type            text/html; charset="ISO-8859-1"
Content-Length          524
Proxy-Connection        Keep-Alive
Connection              Keep-Alive
Age                     0

Is there another way to do directly edit the HTTP-Header?

Thanks in advance,
Mathias

Parents
  • Hi,

    i found a workaround to force the save as with the content-type: "application/x-unknown".

    U8 *cgx_content_type (void)
    {
      return( "application/x-unknown\r\n" );
    }
    

    The http-header looks like this:

    Server          Keil-EWEB/2.1
    Content-Type    application/x-unknown
    Cache-Control   no-cache
    Connection      close
    

    Although it would be fine to edit the http header.

Reply
  • Hi,

    i found a workaround to force the save as with the content-type: "application/x-unknown".

    U8 *cgx_content_type (void)
    {
      return( "application/x-unknown\r\n" );
    }
    

    The http-header looks like this:

    Server          Keil-EWEB/2.1
    Content-Type    application/x-unknown
    Cache-Control   no-cache
    Connection      close
    

    Although it would be fine to edit the http header.

Children
No data