an idea... I once sort did something sorta similar.
I used an incoming header to set a server var in htaccess. then I appended that to the query string again in htaccess. then I used that to set a global var.
would that work for you?
I also seem to remember something about apache level server vars being available within miva... but that was a long time ago as in maybe 2006ish... it's worth exploring.
Announcement
Collapse
No announcement yet.
Access headers in order
Collapse
X
-
OK, got it, I'll see what I can hack together based on that. Thanks!
Leave a comment:
-
-
There isn't a specific function for this, but if Empresa is running under CGI with a typical CGI handler having invoked it and set environment variables with the http headers, then those variables will have been auto assigned an equivalent s.http_NAME variable with the header. You could of course iterate over all the variables, but that wouldn't be the best for performance. You would not be able to determine the order in which the headers were sent because that information would not be sent to Empresa. I'm not sure if you'd be able to determine that at all unless you wrote a different handler for the web server you're using to attach an order of occurrence to the headers as they're passed to the application receiving the request.
- 1 like
Leave a comment:
-
Ok. I may be remembering something from a while ago..
https://www.miva.com/forums/forum/pa...l-http-headers
I do recall though writing some code that grabbed everything and wrote it to a file....
I am hoping someone else can chime in...
- 1 like
Leave a comment:
-
my bad - I knew I wasn't reading something right.
I am 99% certain miva_output_flush will do this, and that I have done it - but I can't locate it in my code....
I will keep looking...
- 1 like
Leave a comment:
-
This should cycle thru all the cookies. And I _think_ in the order they were entered.
Leave a comment:
-
I'm looking for the MivaScript equivalent of PHP's getallheaders function.
http://php.net/manual/en/function.getallheaders.php
Leave a comment:
-
Bill, thanks for replying. I'm not entirely sure how I would use that function...for example, what do you pass in for sessInfo? But, that said, it looks like this might just parse cookies and not http headers. Tell me if I'm wrong about that!
susan
Leave a comment:
-
If I am reading right, this should help:
Code:<MvFunction name="getSession" parameters="sessInfo" standardoutputlevel="html,text,compresswhitespace"> <MvASSIGN NAME = "l.cookies" VALUE = ""> <MvASSIGN NAME = "l.pos" VALUE = 1> <MvASSIGN NAME = "l.cookie" VALUE = "{ trim( gettoken( sessInfo, ';', l.pos ) ) }"> <MvWHILE EXPR = "{ len( l.cookie ) }"> <MvASSIGN NAME = "l.cookie_name" VALUE = "{ trim( gettoken( l.cookie, '=', 1 ) ) }"> <MvASSIGN NAME = "l.cookie_value" VALUE = "{ trim( gettoken( l.cookie, '=', 2 ) ) }"> <MvASSIGN NAME = "l.cookies" MEMBER = "{ l.cookie_name }" VALUE = "{ l.cookie_value }"> <MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }"> <MvASSIGN NAME = "l.cookie" VALUE = "{ trim( gettoken( s.http_cookie, ';', l.pos ) ) }"> </MvWHILE> <MvAssign name="theSess" value="{ gettoken(cookies:xxxxxx,'|',4) }"> <MvAssign name="theToken" value="{ gettoken(cookies:xxxxxx,'|',3) }"> <MvAssign name="somethingNew" value="{ gettoken(cookies:xxxxx,'|',2) }"> <MvAssign name="isEnabled" value="{ gettoken(cookies:xxxxx,'|',1) }"> </MvFunction>
Leave a comment:
-
Access headers in order
I'm working on an integration where I need to access and provide the HTTP headers (just the names, not the values) in the order they were sent to the script. So I would build a string such as:
Host,Connection,Cookie,Cache-Control
Now I know I can look at those individually, such as s.http_host, s.http_cache_control, etc. But in order to do that, I already have to know which ones were sent (or at least a superset of all that could be sent). And I wouldn't have them in the same order as they were presented to the script.
Is there a way I can just access the raw headers themselves?
Thanks,
SusanTags: None
Leave a comment: