Feature #319

Allow user modify response headers in Skylark

Added by Jan Dolinár over 11 years ago. Updated over 11 years ago.

Status:ApprovedStart date:08/28/2012
Priority:NormalDue date:
Assignee:Miroslav Fidler% Done:


Category:Wpp (web framework)Spent time:-
Target version:-


Skylark user has currently no way to influence the headers sent in the response. This is IMHO wrong, especially for Cache-Control header which is currently hardcoded to "no-cache".

Attached patch adds two methods, ClearHeader() and SetHeader(), providing user full control. Intended usage would be for example tweaking the caching for static resources:

SKYLARK(Favicon, "/favicon.ico") {
    String icon = GetDataFile("favicon.png");
    String tag = IntStr64(GetFileTime(icon).ft);
    http.SetHeader("Cache-Control", "max-age=2592000");
    http.SetHeader("ETag", tag);
    if(http.GetHeader("if-none-match") != tag){
        http.ContentType("image/png") << LoadFile(icon);
    } else {
        http.Response(304, "Not Modified");

Skylark.diff Magnifier (2.41 KB) Jan Dolinár, 08/28/2012 09:45 PM


#1 Updated by Jan Dolinár over 11 years ago

EDIT: corrected the example

#2 Updated by Miroslav Fidler over 11 years ago

  • Status changed from Patch ready to Approved

Also available in: Atom PDF