RealTimeLogic / BAS

Embedded Web Server Library with Integrated Scripting Engine
https://realtimelogic.com/products/barracuda-application-server/
GNU General Public License v2.0
58 stars 14 forks source link

can not get or change default response header Server #6

Closed badiku closed 1 year ago

badiku commented 1 year ago

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.

surfskidude commented 1 year ago

This is a feature. Some headers are reserved. The following works: response:setheader('Hello', 'World') trace(response:containsheader'Hello')