Forum

CGI environment variable HTTP_ACCEPT_ENCODING

Carsten
17 September 2014, 12:57
Hello Hugo,

I'm missing support for this specific environment variable. I have scanned your code in xslt.c and envir.c, but did not find it. HTTP_ACCEPT, HTTP_ACCEPT_CHARSET and HTTP_ACCEPT_LANGUAGE seems to be supported. I need HTTP_ACCEPT_ENCODING to determine if the requesting user agent is capable to handle compressed data in my response.

Can I simply add a line in xslt.c like "add_http_header(session, params, "Accept-Encoding:", "HTTP_ACCEPT_ENCODING", &i);" to make it work?

Thank you for this excellent Webserver, and thank you for your answer.

Best regards,

Carsten

Hiawatha version: 9.4
Operating System: Linux
Hugo Leisink
17 September 2014, 14:57
If you need it to be added to the CGI environment, than adding it to xslt.c won't help. Are you sure the browser sends one? Because Hiawatha can only add to the CGI environment what the browser sends.
Carsten
17 September 2014, 17:04
Yes the browser sends a request-header which contains the field "Accept-Encoding: deflate, gzip". I can see it with the Firefox developer tools and Wireshark. This is in accordance with RFC2616 clause 14.3. How can I enable Hiawatha to add this Information to the CGI environment variable HTTP_ACCEPT_ENCODING or where is the right place to add it in your opinion?
Hugo Leisink
17 September 2014, 17:09
All HTTP headers are placed in the CGI environment. So, if it's send by your browser and not proxy in between filters it, it should be present in your CGI environment. Try
print_r($_SERVER);

assuming you are using PHP.
Carsten
18 September 2014, 10:33
It works fine. My problem was not Hiawatha nor CGI related. Thank you very much for your help and fast response.
This topic has been closed.