From: Lucian Mogosanu Date: Tue, 27 Aug 2019 15:35:09 +0000 (+0300) Subject: drafts, hunchentoot-vib: Complete draft X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=24aff90fd9303fa3ba06a4fa6700dae55a9499bb;p=thetarpit.git drafts, hunchentoot-vib: Complete draft --- diff --git a/drafts/000-hunchentoot-vib.markdown b/drafts/000-hunchentoot-vib.markdown index cd5677e..ee2ca67 100644 --- a/drafts/000-hunchentoot-vib.markdown +++ b/drafts/000-hunchentoot-vib.markdown @@ -233,27 +233,71 @@ Since we've fortunately exhausted request.lisp, we're left with: **[[]]** [**reply**][ht-c-rep]: The "response" counterpart to request objects; holds the response [content-type][ht-ct-slot], [length][ht-cl-slot], [headers][ht-ho-slot], [return -code][ht-rc-slot], [encoding][ht-ef-slot] and [cookies][ht-co-slot]. +code][ht-rc-slot], [encoding][ht-ef-slot] and +[cookies][ht-co-slot]. Implemented methods: [ii3] [**initialize-instance**][ht-ii3]: +":after" the reply object is instantiated, set content-type header to +the \*default-content-type\*. -[hos] [**headers-out\***][ht-hos]: +The following are, similarly to the request accessor functions, +wrappers which implicitly bind their reply argument to the \*reply\* +special. Also, most of them also come with a setf definition, which +simply set the associated slot of the reply argument (also bound to +\*reply\* unless specified) to a given new-value. I shan't bother to +give details where there are none, here they are: + +[hos] [**headers-out\***][ht-hos] [cos] [**cookies-out\***][ht-cos]: +[setf-er][ht-cos-setf]. [cts] [**content-type\***][ht-cts]: +[setf-er][ht-cts-setf]. [cls] [**content-length\***][ht-cls]: +[setf-er][ht-cls-setf]. [rcs] [**return-code\***][ht-rcs]: - -[refs] [**reply-external-format\***][ht-refs]: - -[hosp] [**header-out-set-p**][ht-hosp]: - -[ho] [**header-out**][ht-ho]: - -[co] [**cookie-out**][ht-co]: +[setf-er][ht-rcs-setf]. + +[refs] [**reply-external-format\***][ht-refs]: +[setf-er][ht-refs-setf]. + +[hosp] [**header-out-set-p**][ht-hosp]: Looks up an +output [header][ht-ho-slot] and returns true if found. + +[ho] [**header-out**][ht-ho]: Looks up a(n +output) [header][ht-ho-slot] and, if found, returns its value. Unlike +[the previous](#hosp) function, this one also comes with a +[setf-er][ht-ho-setf] which e.g. performs conversions if the name +provided is a string etc. and checks the types of content-type and +content-length headers. + +[co] [**cookie-out**][ht-co]: Looks up a +cookie in the respective [alist][ht-co-slot] and returns its value if +found. + +This is it, then: a complete review of all the [core][hunchentoot-iii] +architectural components of Hunchentoot. Remember, this program +actually works, and not by mere happenstance, but quite deliberately, +as the result of what I expect was hard work to bake this tangled +shawarma. Note that I don't plan to add *any* functionality to the +current mess, at least not until completely rewriting it, preferably +on top of a not-completely-fucked [WWW stack][logs-mp-on-lisp-www]. If +you want to make a Lisp logger/blog/web front-end using current-day +WWW, then it seems unfortunately that this is the best you got. + +Having said that, the next episode in the Hunchentoot saga will reveal +two items: a genesis of the Hunchentoot that was reviewed here, and +one of Hunchentoot plus [all its dependencies][hunchentoot-deps], for +which I can only vouch by noting that they sorta work, not that they +do precisely what's written on the label. Then I can start building +around this: a comment mechanism for this blog, an IRC logger, a +pastebin and all those other fundamental webthings that keep things +running. [^1]: Special variables have a [special meaning][cltl-special] in Common Lisp -- see what I did there? Namely, a special variable @@ -380,3 +424,6 @@ code][ht-rc-slot], [encoding][ht-ef-slot] and [cookies][ht-co-slot]. [usocket-wmc]: https://quickref.common-lisp.net/usocket.html#go-to-the-USOCKET_003ccolon_003e_003ccolon_003eWITH_002dMAPPED_002dCONDITIONS-macro [clhs-catch]: http://www.lispworks.com/documentation/HyperSpec/Body/s_catch.htm [clhs-unwind-protect]: http://www.lispworks.com/documentation/HyperSpec/Body/s_unwind.htm +[hunchentoot-iii]: /posts/y06/097-hunchentoot-iii.html +[logs-mp-on-lisp-www]: http://logs.nosuchlabs.com/log/trilema/2019-08-01#1926066 +[hunchentoot-deps]: /posts/y06/097-hunchentoot-iii.html#fn3