Erlang Mailing Lists

Author Message

<  Yaws mailing list  ~  Getting specific values from hearders(User-Agent, Accept-Lan

Guest
Posted: Mon Feb 15, 2010 3:35 pm Reply with quote
Guest
You should read this documentation :

http://yaws.hyber.org/yman.yaws?page=yaws_api

if the header is not directly accessible from the record #headers, you have to parse the #headers.other field like I said before.





>Thanks, Steve. Your idea works for User-Agent but it doesn't work with
>other header values like "Accept-Charset" and "Accept-Language"
>
>----------------------------------------------------------------
>
><erl>
>out(Arg) ->
> {status, 200},
> {content, "text/html", ""}.
></erl>
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
><html xmlns="http://www.w3.org/1999/xhtml">
><head>
><title>Details about the Reuqest</title>
><style type="text/css">
>span {color: red;}
>h2{font-size: 12pt;}
></style>
></head>
><body>
>
><h1>Details</h1>
>
><h2>Your user agent is:
> <span>
> <erl>
> out(A) ->
> {html, (A#arg.headers)#headers.user_agent}.
> </erl>
> </span></h2>
>
><h2>Host:
> <span>
> <erl>
> out(A) ->
> {html, (A#arg.headers)#headers.host}.
> </erl>
> </span></h2>
>
><h2>Accept-Language:
> <span>
> <erl>
> out(A) ->
> {html, (A#arg.headers)#headers.accept_language}.
> </erl>
> </span></h2>
>
><h2>Accept-Charset:
> <span>
> <erl>
> out(A) ->
> {html, (A#arg.headers)#headers.accept_charset}.
> </erl>
> </span></h2>
>
></body>
></html>
>
>------------------------------------------------------------------------------
>SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
>Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>http://p.sf.net/sfu/solaris-dev2dev
>_______________________________________________
>Erlyaws-list mailing list
>Erlyaws-list@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>



------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum