I've just committed the culmination of this thread.<div><br></div><div>I've removed the coercive contracts and replaced them with a global imperative any->response hook that defaults to "off" but can easily be turned "on" to support X-exprs or the old behavior of the Web Server.</div>
<div><br></div><div>Jay<br><br><div class="gmail_quote">On Fri, Nov 26, 2010 at 5:55 PM, Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I would like to remove the implicit preference the Web Server gives to<br>
Xexprs and the old esoteric bytes response format. This is backwards<br>
incompatible change, but I think it will make the server better in the<br>
long run as it will promote other HTML encodings, like the xml and<br>
html modules, Eli's new system, SXML, etc. I am interested in your<br>
opinion.<br>
<br>
-- Details --<br>
<br>
Everywhere that the server expects a "response" uses the response/c contract<br>
<br>
<a href="http://pre.racket-lang.org/docs/html/web-server/http.html#(def._((lib._web-server/http/response-structs..rkt)._response/c))" target="_blank">http://pre.racket-lang.org/docs/html/web-server/http.html#(def._((lib._web-server/http/response-structs..rkt)._response/c))</a><br>
<br>
This allows the native HTTP response data structures, Xexprs, and<br>
lists that start with bytes (the MIME type) where everything after is<br>
a byte string or normal string. [I have no idea where that last thing<br>
came from, but it was in the legacy server and I've kept it<br>
compatible.]<br>
<br>
In addition to backwards incompatibility, this could make Web<br>
programming a bit more verbose, because you'd have to explicitly call<br>
"make-xexpr-response" to construct the response from the Xexpr. I<br>
could ease that a little bit by changing its name to "xexpr" or<br>
something similar.<br>
<br>
Any ideas on the best way to deal with this?<br>
<br>
Jay<br>
<font color="#888888"><br>
--<br>
Jay McCarthy <<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br>
<a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>
"The glory of God is Intelligence" - D&C 93<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>
</div>