forked from GitHub/gf-core
pgf-server HTTP mode: support the Accept-Language header
It is needed for the userLanguage field in the grammar info from pgf-server
This commit is contained in:
@@ -29,11 +29,13 @@ cgiReq (Request method uri hdrs body) = CGIRequest vars inputs body'
|
|||||||
vars = M.fromList [("REQUEST_METHOD",method),
|
vars = M.fromList [("REQUEST_METHOD",method),
|
||||||
("REQUEST_URI",show uri),
|
("REQUEST_URI",show uri),
|
||||||
("SCRIPT_FILENAME",documentRoot++uriPath uri),
|
("SCRIPT_FILENAME",documentRoot++uriPath uri),
|
||||||
("QUERY_STRING",qs)]
|
("QUERY_STRING",qs),
|
||||||
|
("HTTP_ACCEPT_LANGUAGE",al)]
|
||||||
qs = case uriQuery uri of
|
qs = case uriQuery uri of
|
||||||
'?':'&':s -> s -- httpd-shed bug workaround
|
'?':'&':s -> s -- httpd-shed bug workaround
|
||||||
'?':s -> s
|
'?':s -> s
|
||||||
s -> s
|
s -> s
|
||||||
|
al = maybe "" id $ lookup "Accept-Language" hdrs
|
||||||
inputs = map input $ queryToArguments qs -- assumes method=="GET"
|
inputs = map input $ queryToArguments qs -- assumes method=="GET"
|
||||||
body' = BS.pack body
|
body' = BS.pack body
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user