Skip to content

can not get or change default response header Server #6

Description

@badiku

hi, just tried mako server.

I got blank string for response header Server,
while I cound see from Chrome devtools that it's value is MakoServer.net

<?lsp 
response:write('Server: ',response:containsheader('Server'))  -- got blank string
 ?>

and if I change header Server to other strings,
I cound get this string,
but I could see from Chrome devtools that it's value is MakoServer.net and this string.
there're two values for header Server now. why?

<?lsp 
response:setheader('Server', 'myServer')
response:write('Server: ',response:containsheader('Server'))  -- got myServer, but MakoServer.net still exists
 ?>

d

is this a bug , or it is a feature ?

doc says that the new value overwrites the previous one :

response:setheader(name [, value])
Sets a HTTP response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The response:containsheader method can be used to test for the presence of a header before setting its value. If the value is not provided then the named header is removed from the response.
setheader() should be called before the response has been committed to the client, (before response body output has been flushed). If the response already has been committed, this method returns false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions