mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
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),
|
||||
("REQUEST_URI",show uri),
|
||||
("SCRIPT_FILENAME",documentRoot++uriPath uri),
|
||||
("QUERY_STRING",qs)]
|
||||
("QUERY_STRING",qs),
|
||||
("HTTP_ACCEPT_LANGUAGE",al)]
|
||||
qs = case uriQuery uri of
|
||||
'?':'&':s -> s -- httpd-shed bug workaround
|
||||
'?':s -> s
|
||||
s -> s
|
||||
al = maybe "" id $ lookup "Accept-Language" hdrs
|
||||
inputs = map input $ queryToArguments qs -- assumes method=="GET"
|
||||
body' = BS.pack body
|
||||
|
||||
|
||||
Reference in New Issue
Block a user