From: Lucian Mogosanu Date: Tue, 27 Aug 2019 14:16:53 +0000 (+0300) Subject: drafts, hunchentoot-vib: Update X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=a5b918df32ad2bc7090e0d74e25d7fc62e213b1e;p=thetarpit.git drafts, hunchentoot-vib: Update - Finish documenting requests - Add skeleton for replies --- diff --git a/drafts/000-hunchentoot-vib.markdown b/drafts/000-hunchentoot-vib.markdown index 70b752b..cd5677e 100644 --- a/drafts/000-hunchentoot-vib.markdown +++ b/drafts/000-hunchentoot-vib.markdown @@ -180,17 +180,19 @@ strings; f\. the namestring isn't "..". g\. When (b)-(f) are satisfied, return the parsed pathname. -TODO: transition to process-request. +Since all these functions bind at least one of their arguments to +\*request\*, we also have: [wrp] [**within-request-p**][ht-wrp]: +When \*request\* is bound, return it. -TODO: another transition to process-request. +And finally: [pr] [**process-request**][ht-pr]: This function is on the main request processing/handling path, and is called by [process-connection][ht-pc] whenever a new HTTP request is available. It does a bunch of more or less related things, let's take -'em one by one. +them one by one. a\. the first part of the function a1. defines and binds some special variables, e.g. the current \*request\* being processed, and a2. wraps @@ -222,9 +224,36 @@ look at it: "request processing" calls "start output" -- which by the way, is part of "headers", right? but this same "start output" is the one which actually delivers a response to the client, which response delivery oughta be part of "reply"!! So to conclude: this whole shit -is in dire need of refactoring and ultimately a complete -rewrite. No-no, this time I'm pretty damn sure it's not the protocol's -fault for this abomination. +is in dire need of refactoring and ultimately a complete rewrite. No, +no, this time I'm pretty damn sure it's not the protocol's fault for +this abomination. + +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]. + +[ii3] [**initialize-instance**][ht-ii3]: + +[hos] [**headers-out\***][ht-hos]: + +[cos] [**cookies-out\***][ht-cos]: + +[cts] [**content-type\***][ht-cts]: + +[cls] [**content-length\***][ht-cls]: + +[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]: [^1]: Special variables have a [special meaning][cltl-special] in Common Lisp -- see what I did there? Namely, a special variable @@ -320,6 +349,29 @@ fault for this abomination. [ht-effct]: /posts/y06/09c-hunchentoot-via.html#effct [ht-ad-slot]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L90 [ht-sn-slot]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L79 +[ht-c-rep]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L31 +[ht-ct-slot]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L32 +[ht-cl-slot]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L35 +[ht-ho-slot]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L40 +[ht-rc-slot]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L46 +[ht-ef-slot]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L51 +[ht-co-slot]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L55 +[ht-ii3]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L69 +[ht-hos]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L72 +[ht-cos]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L77 +[ht-cos-setf]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L82 +[ht-cts]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L87 +[ht-cts-setf]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L91 +[ht-cls]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L95 +[ht-cls-setf]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L99 +[ht-rcs]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L103 +[ht-rcs-setf]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L108 +[ht-refs]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L112 +[ht-refs-setf]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L116 +[ht-hosp]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L120 +[ht-ho]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L125 +[ht-co]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L130 +[ht-ho-setf]: http://coad.thetarpit.org/hunchentoot/c-reply.lisp.html#L135 [clhs-parse-namestring]: http://clhs.lisp.se/Body/f_pars_1.htm [sbcl-nf]: http://www.sbcl.org/manual/#Native-Filenames [flex-ots]: http://edicl.github.io/flexi-streams/#octets-to-string