[erlang-questions] Attempting to rewrite headers, obstacles faced

Bhasker Kode <>
Mon Apr 28 08:56:33 CEST 2008


Hello,

i've been trying to research how to rewrite request headers (from yaws),
when I remember that there folks on these lists, who have written
substantial code that works with header. Cheers to that...

I have tried the following 3 methods to try and rewrite the headers (more
specificaly the #headers{referer}

Attempt [1]
hacked within yaws.erl, only to find that the Referer when edited, was only
being used in yaws_log:accesslogs. ( http://paste.lisp.org/display/59461 )
Result: No change in arg structure , no change in document.referrer.

Attempt [2]
tried setting within out(A)  http://paste.lisp.org/display/59461#1
Result: No chagne in arg structure, no change in document.referrer.

Attempt [3]
rewriting the referer, just as arg_rewrite rewrites path, but instead return
an Arg with different referer .
Result: interestingly this worked in editing the Arg record, and when asked
to yaws_api:reformat_headers, to show the headers, it did show the newly set
referer.
But...no change in document.referrer.. : /  . The browser's
document.referrer still showed the old one. (
http://paste.lisp.org/display/59461#2 )

Please do have look into http://paste.lisp.org/display/59461 for the
snippets of the three attempts. My questions are ...

Q1. Is is possible to rewrite headers such as referer within yaws ?
Q2. Would you know of any explanation as to why the Arg showed referer as X,
but the browser still takes Y. I've heard Apache2 (using curl) has support
for manipulating request headers such as referrer, but i'm committed to
doing the same in yaws as well.

Keep Clicking,
Bosky ( bosky101 on #erlang)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080428/f5487272/attachment.html>


More information about the erlang-questions mailing list