From b13e741975d1785b8ed78c54dc5b639a0499efbc Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Tue, 20 Aug 2019 16:28:02 +0300 Subject: [PATCH] drafts, hunchentoot-vi: Update --- drafts/000-hunchentoot-vi.markdown | 170 ++++++++++++++++++++++++++++++++++-- 1 file changed, 165 insertions(+), 5 deletions(-) diff --git a/drafts/000-hunchentoot-vi.markdown b/drafts/000-hunchentoot-vi.markdown index c5da5f8..cf59587 100644 --- a/drafts/000-hunchentoot-vi.markdown +++ b/drafts/000-hunchentoot-vi.markdown @@ -10,11 +10,11 @@ This post is part of a series on [Common Lisp WWWism][cl-www], more specifically dissecting the Common Lisp web server known as Hunchentoot. Other posts in the series include: -* a walk through the project's [history][ht-i]; -* a set of [architectural notes][ht-ii] and [follow-up][ht-iii] on the - same; -* a review of [acceptors][ht-iv]; and -* a review of [taskmasters][ht-v]. +* a walk through the project's [history][hunchentoot-i]; +* a set of [architectural notes][hunchentoot-ii] and + [follow-up][hunchentoot-iii] on the same; +* a review of [acceptors][hunchentoot-iv]; and +* a review of [taskmasters][hunchentoot-v]. This post will discuss the objects known as "requests" and "replies", as they are part of the very same fundamental mechanism. @@ -54,6 +54,112 @@ this; the actual policy (i.e. whether a resource is to be associated with a file on the disk, or a set of database entries or whatever) is implemented by the user. +In what is becoming a traditional tarpitian style of documenting code, +we will move directly to: + +**[[]]** [**request**][ht-c-req]: Object holding everything pertaining +to a HTTP request: headers, a method, local/remote address/ports, the +protocol version, a socket stream, GET/POST parameters, the resource +being requested; additionally: the raw POST data, a reference to the +acceptor on which the request was made, "auxiliary data" to be +employed by the user however he or she wishes. + +Note that (somewhat counter-intuitively) request parsing and object +creation doesn't occur in request.lisp, but upstream in +[process-connection][ht-pc], and more specifically headers are parsed +in headers.lisp, in [get-request-data][ht-iv-grd][^3]. So then what +does request.lisp do? Well, it: defines the data structure; implements +a lot of scaffolding for GET and POST parameter parsing; implements a +user interface for request handlers; and finally, it creates a context +in which request handlers can be safely executed, i.e. if something +fails, execution can be unwound to the place where +[handle-request][ht-hr] was called and an error response can be logged +and returned. Let's look at each of these pieces. + +[ch] [**convert-hack**][ht-ch]: + +[prfd] +[**parse-rfc2388-form-data**][ht-prfd]: + +[prfd] [**get-post-data**][ht-gpd]: + +[ii2] [**initialize-instance**][ht-ii2]: + +[pr] [**process-request**][ht-pr]: + +[wrp] [**within-request-p**][ht-wrp]: + +[mrpp] +[**maybe-read-post-parameters**][ht-mrpp]: + +[rrp] +[**recompute-request-parameters**][ht-rrp]: + +[sns] [**script-name\***][ht-sns]: + +[qss] [**query-string\***][ht-qss]: + +[gps] [**get-parameters\***][ht-gps]: + +[pp] [**post-parameters**][ht-pp]: + +[pps] [**post-parameters\***][ht-pps]: + +[his] [**headers-in\***][ht-his]: + +[cis] [**cookies-in\***][ht-cis]: + +[hi] [**header-in**][ht-hi]: + +[his2] [**header-in\***][ht-his2]: + +[a] [**authorization**][ht-a]: + +[ras] [**remote-addr\***][ht-ras]: + +[rps] [**remote-port\***][ht-rps]: + +[las] [**local-addr\***][ht-las]: + +[lps] [**local-port\***][ht-lps]: + +[rra] [**real-remote-addr**][ht-rra]: + +[h] [**host**][ht-h]: + +[rus] [**request-uri\***][ht-rus]: + +[rms] [**request-method\***][ht-rms]: + +[sps] [**server-protocol\***][ht-sps]: + +[ua] [**user-agent**][ht-ua]: + +[ci] [**cookie-in**][ht-ci]: + +[r] [**referer**][ht-r]: + +[gp] [**get-parameter**][ht-gp]: + +[pp] [**post-parameter**][ht-pp]: + +[p] [**parameter**][ht-p]: + +[hims] [**handle-if-modified-since**][ht-hims]: + +[effct] +[**external-format-from-content-type**][ht-effct]: + +[rpd] [**raw-post-data**][ht-rpd]: + +[arv] [**aux-request-value**][ht-arv]: + +[darv] [**delete-aux-request-value**][ht-darv]: + +[pp2] [**parse-path**][ht-pp2]: + +[rp] [**request-pathname**][ht-rp]: + [^1]: In practice some c in C can also be a s in S and vice-versa, why not? In a sane world C and S would be the same set, and thus our client-server-herpderp model would become that of a peer-to-peer @@ -78,6 +184,14 @@ implemented by the user. In other words, fuck these sons of bitches and all their cancerous "improvements". +[^3]: And here's where I find out I've actually been reading all this + in the correct order, given that *I know* where this particular + bit occurs and I don't need to spend hours digging into finding + out. Pretty neat, huh? + + Now how 'bout *you* get a blog and start doing this for the coad + that you're using? Wouldn't that be neat? + [chunking]: /posts/y06/098-hunchentoot-iv.html#fn2 [tcp]: /posts/y05/096-hunchentoot-ii.html#fn1 [alf-cl-on-pc]: http://trilema.com/2019/trilema-goes-dark/#comment-130686 @@ -89,3 +203,49 @@ implemented by the user. [rfc-8615]: https://tools.ietf.org/html/rfc8615 [rfc-1945-5]: https://tools.ietf.org/html/rfc1945#section-5 [rfc-1945-6]: https://tools.ietf.org/html/rfc1945#section-6 +[ht-c-req]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L31 +[ht-ch]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L118 +[ht-prfd]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L127 +[ht-gpd]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L150 +[ht-ii2]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L185 +[ht-pr]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L219 +[ht-wrp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L262 +[ht-pmfd]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L266 +[ht-mrpp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L282 +[ht-rrp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L334 +[ht-sns]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L344 +[ht-qss]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L349 +[ht-gps]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L354 +[ht-pp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L359 +[ht-pps]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L368 +[ht-his]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L373 +[ht-cis]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L378 +[ht-hi]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L383 +[ht-his2]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L389 +[ht-a]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L394 +[ht-ras]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L407 +[ht-rps]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L411 +[ht-las]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L415 +[ht-lps]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L419 +[ht-rra]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L423 +[ht-h]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L433 +[ht-rus]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L437 +[ht-rms]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L441 +[ht-sps]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L445 +[ht-ua]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L449 +[ht-ci]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L453 +[ht-r]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L458 +[ht-gp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L462 +[ht-pp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L467 +[ht-p]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L472 +[ht-hims]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L480 +[ht-effct]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L495 +[ht-rpd]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L508 +[ht-arv]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L551 +[ht-arv2]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L559 +[ht-darv]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L576 +[ht-pp2]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L585 +[ht-rp]: http://coad.thetarpit.org/hunchentoot/c-request.lisp.html#L613 +[ht-pc]: /posts/y06/098-hunchentoot-iv.html#pc +[ht-iv-grd]: /posts/y06/098-hunchentoot-iv.html#fn3 +[ht-hr]: /posts/y06/098-hunchentoot-iv.html#hr -- 1.7.10.4