From edi at agharta.de Thu Jun 9 08:44:29 2005 From: edi at agharta.de (Edi Weitz) Date: Thu, 09 Jun 2005 10:44:29 +0200 Subject: [tbnl-devel] Re: Concerning TBNL and HTML-TEMPLATE In-Reply-To: <42A78374.1080308@albany.edu> (Dan Larkin's message of "Wed, 08 Jun 2005 19:47:00 -0400") References: <42A78374.1080308@albany.edu> Message-ID: Hi Dan! Please use the mailing lists for future questions like these - see Cc and the links on the websites. Thanks. On Wed, 08 Jun 2005 19:47:00 -0400, Dan Larkin wrote: > First of all let me thank you for your terrific software. The > availability of your software (and others too) has really helped > my picking up lisp. You're welcome... :) > For the past few days I've been reading c.l.l (but not posting, > because I don't know nearly enough to participate in any of the > current discussions). My background with lisp began this winter > when I started a course at my University in scheme. Since then > I've been trying to get going with common lisp and web > programming (since that is what I do during the summer at my > job). Good luck! I'm sure you'll have fun with CL. > But anyway, on to my question: How can I get a template parsed > with html-template to come up with as a tbnl page? I'm working > off the tbnl-test example so I have just created a new function > add-artist' and added it to dispatch table, but I can't figure out > how to get it to output the results of parsing a template. Something like (defun add-artist () (with-output-to-string (*default-template-output*) (fill-and-print-template template/printer values))) should do it. Note that FILL-AND-PRINT-TEMPLATE prints its output to the stream *DEFAULT-TEMPLATE-OUTPUT* and TBNL wants a string returned by the handler, so the code above makes sure everything printed to this stream ends up in a string which is returned by the function. This assumes that ADD-ARTIST is a handler, not a dispatcher. > Also another issue I am having is get-parameters, get-parameter, > post-parameters and post-parameter all don't seem to work. Even > with something like > (defun add-artist () > (with-html > (:html > (get-parameters)))) > does not work (the way I'd expect it to at least, it produces only > the prologue and even when passed parameters). WITH-HTML is the macro which uses CL-WHO from the test suite, right? If that's the case you must wrap the form (GET-PARAMETERS) with something that asks CL-WHO to include it in the output, otherwise it'll only be evaluated for its side effects. One of (str (get-parameters)) (esc (get-parameters)) (fmt "~S" (get-parameters)) should do it. Does that help? Cheers, Edi. From hutch at recursive.ca Fri Jun 10 13:17:23 2005 From: hutch at recursive.ca (Bob Hutchison) Date: Fri, 10 Jun 2005 09:17:23 -0400 Subject: [tbnl-devel] (no subject) Message-ID: <07de62902ae5369cfc2d86239d85f955@recursive.ca> Hi, So far I've got 48 create-static-file-dispatcher-and-handler definitions in my TBNL dispatch table. These are mostly image files now, but also CSS and javascript files. This number is about to go up by maybe five or six real soon now. Then soon after that I'll need to be able to serve an unknown, but large, number of files of different types. Is there currently a dispatcher/handler that deals with directories, possibly even recursively, or maybe that consults some kind of list of things to serve? No point writing one if it is already done. If there isn't one already, I'll code one up and contribute it to TBNL. Cheers, Bob ---- Bob Hutchison -- blogs at Recursive Design Inc. -- From stesch at no-spoon.de Fri Jun 10 13:38:57 2005 From: stesch at no-spoon.de (Stefan Scholl) Date: Fri, 10 Jun 2005 15:38:57 +0200 Subject: [tbnl-devel] (no subject) In-Reply-To: <07de62902ae5369cfc2d86239d85f955@recursive.ca> References: <07de62902ae5369cfc2d86239d85f955@recursive.ca> Message-ID: <20050610133857.GA9758@parsec.no-spoon.de> On 2005-06-10 09:17:23, Bob Hutchison wrote: > So far I've got 48 create-static-file-dispatcher-and-handler > definitions in my TBNL dispatch table. These are mostly image files Apache is really good for this task. You can either put your application (without the static files) into its own directory or the other way. When you want to set the lisp-handler for the whole site except for one directory you could configure it that way: ... SetHandler lisp-handler SetHandler none ... Regards, Stefan From edi at agharta.de Fri Jun 10 13:19:14 2005 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Jun 2005 15:19:14 +0200 Subject: [tbnl-devel] (no subject) In-Reply-To: <07de62902ae5369cfc2d86239d85f955@recursive.ca> (Bob Hutchison's message of "Fri, 10 Jun 2005 09:17:23 -0400") References: <07de62902ae5369cfc2d86239d85f955@recursive.ca> Message-ID: Hi Bob! On Fri, 10 Jun 2005 09:17:23 -0400, Bob Hutchison wrote: > Is there currently a dispatcher/handler that deals with directories, > possibly even recursively, or maybe that consults some kind of list > of things to serve? No, not yet. > No point writing one if it is already done. If there isn't one > already, I'll code one up and contribute it to TBNL. That would be nice. TIA, Edi. From edi at agharta.de Fri Jun 10 13:45:30 2005 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Jun 2005 15:45:30 +0200 Subject: [tbnl-devel] (no subject) In-Reply-To: <20050610133857.GA9758@parsec.no-spoon.de> (Stefan Scholl's message of "Fri, 10 Jun 2005 15:38:57 +0200") References: <07de62902ae5369cfc2d86239d85f955@recursive.ca> <20050610133857.GA9758@parsec.no-spoon.de> Message-ID: On Fri, 10 Jun 2005 15:38:57 +0200, Stefan Scholl wrote: > Apache is really good for this task. Bob is the one who introduced backends other than Apache for TBNL so there's a slight chance he's not even using Apache... :) Cheers, Edi. From hutch at recursive.ca Fri Jun 10 18:35:32 2005 From: hutch at recursive.ca (Bob Hutchison) Date: Fri, 10 Jun 2005 14:35:32 -0400 Subject: [tbnl-devel] (no subject) In-Reply-To: References: <07de62902ae5369cfc2d86239d85f955@recursive.ca> <20050610133857.GA9758@parsec.no-spoon.de> Message-ID: <051570acb557f5745ecbbfdf4843de07@recursive.ca> Hi, Sorry for the delay in replying (meetings all day so far, and on a Friday too) Edi, you are correct :-) I am going straight at TBNL on linux and through Araneida on OS/X (but only because of a weird bug on OS/X that I cannot isolate). An additional issue is that a lot of these files I have to serve are protected by the web application's security system -- some users are not allowed to get access to them, or there may be different versions for different audiences. I am pretty sure I can get Apache to handle this, but that would be work that duplicates functionality that is already done within the lisp application. But you are right Stefan, Apache is good at this and would be a good way to go under other circumstances. Cheers, Bob On Jun 10, 2005, at 9:45 AM, Edi Weitz wrote: > On Fri, 10 Jun 2005 15:38:57 +0200, Stefan Scholl > wrote: > >> Apache is really good for this task. > > Bob is the one who introduced backends other than Apache for TBNL so > there's a slight chance he's not even using Apache... :) > > Cheers, > Edi. > _______________________________________________ > tbnl-devel site list > tbnl-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/tbnl-devel > > ---- Bob Hutchison -- blogs at Recursive Design Inc. -- From keith.irwin at gmail.com Sun Jun 26 00:42:13 2005 From: keith.irwin at gmail.com (Keith Irwin) Date: Sat, 25 Jun 2005 17:42:13 -0700 Subject: [tbnl-devel] sbcl and file upload Message-ID: <8aff8159050625174219f45969@mail.gmail.com> Folks-- I'm using tbnl 0.5.5, sbcl 0.9.1 with mod_lisp2 (for apache2) and can't seem to get file upload working because of: [error] [TBNL] While parsing multipart/form-data parameters: decoding error on stream [error] [TBNL] # [error] [TBNL] (:EXTERNAL-FORMAT :UTF-8): [error] [TBNL] the octet sequence (137) cannot [error] [TBNL] be decoded. The files I want to upload are images. Uploading text works just fine. I'm guessing this has something to do with SBCL not allowing bivalent streams (or whatever, it's been awhile). Is there any option with SBCL? Any chance that a CVS version solves this? TBNL using SBCL's simple streams? I already serve images via straight apache. Any recommendations? -- K {} From edi at agharta.de Sun Jun 26 06:26:17 2005 From: edi at agharta.de (Edi Weitz) Date: Sun, 26 Jun 2005 08:26:17 +0200 Subject: [tbnl-devel] sbcl and file upload In-Reply-To: <8aff8159050625174219f45969@mail.gmail.com> (Keith Irwin's message of "Sat, 25 Jun 2005 17:42:13 -0700") References: <8aff8159050625174219f45969@mail.gmail.com> Message-ID: On Sat, 25 Jun 2005 17:42:13 -0700, Keith Irwin wrote: > I'm using tbnl 0.5.5, sbcl 0.9.1 with mod_lisp2 (for apache2) and > can't seem to get file upload working because of: > > [error] [TBNL] While parsing multipart/form-data parameters: > decoding error on stream > > [error] [TBNL] # "a constant string" {A20C1C9}> > > [error] [TBNL] (:EXTERNAL-FORMAT :UTF-8): > [error] [TBNL] the octet sequence (137) cannot > [error] [TBNL] be decoded. > > The files I want to upload are images. Uploading text works just fine. > > I'm guessing this has something to do with SBCL not allowing > bivalent streams (or whatever, it's been awhile). Is there any > option with SBCL? Any chance that a CVS version solves this? TBNL > using SBCL's simple streams? > > I already serve images via straight apache. > > Any recommendations? Hi! I'm still waiting for patches to make TBNL work with Unicode versions of SBCL as I don't use SBCL myself. Any volunteers? Cheers, Edi. From keith.irwin at gmail.com Sun Jun 26 16:31:00 2005 From: keith.irwin at gmail.com (Keith Irwin) Date: Sun, 26 Jun 2005 09:31:00 -0700 Subject: [tbnl-devel] sbcl and file upload In-Reply-To: References: <8aff8159050625174219f45969@mail.gmail.com> Message-ID: <8aff8159050626093122bd1ed9@mail.gmail.com> What needs to be patched? tbnl or kmrcl? Keith On 6/25/05, Edi Weitz wrote: > On Sat, 25 Jun 2005 17:42:13 -0700, Keith Irwin wrote: > > > I'm using tbnl 0.5.5, sbcl 0.9.1 with mod_lisp2 (for apache2) and > > can't seem to get file upload working because of: > > > > [error] [TBNL] While parsing multipart/form-data parameters: > > decoding error on stream > > > > [error] [TBNL] # > "a constant string" {A20C1C9}> > > > > [error] [TBNL] (:EXTERNAL-FORMAT :UTF-8): > > [error] [TBNL] the octet sequence (137) cannot > > [error] [TBNL] be decoded. > > > > The files I want to upload are images. Uploading text works just fine. > > > > I'm guessing this has something to do with SBCL not allowing > > bivalent streams (or whatever, it's been awhile). Is there any > > option with SBCL? Any chance that a CVS version solves this? TBNL > > using SBCL's simple streams? > > > > I already serve images via straight apache. > > > > Any recommendations? > > Hi! > > I'm still waiting for patches to make TBNL work with Unicode versions > of SBCL as I don't use SBCL myself. Any volunteers? > > Cheers, > Edi. > From edi at agharta.de Sun Jun 26 19:55:29 2005 From: edi at agharta.de (Edi Weitz) Date: Sun, 26 Jun 2005 21:55:29 +0200 Subject: [tbnl-devel] sbcl and file upload In-Reply-To: <8aff8159050626093122bd1ed9@mail.gmail.com> (Keith Irwin's message of "Sun, 26 Jun 2005 09:31:00 -0700") References: <8aff8159050625174219f45969@mail.gmail.com> <8aff8159050626093122bd1ed9@mail.gmail.com> Message-ID: On Sun, 26 Jun 2005 09:31:00 -0700, Keith Irwin wrote: > What needs to be patched? tbnl or kmrcl? I think for the stream stuff it's TBNL that needs to be patched. Cheers, Edi. From edi at agharta.de Sun Jun 26 21:41:10 2005 From: edi at agharta.de (Edi Weitz) Date: Sun, 26 Jun 2005 23:41:10 +0200 Subject: [tbnl-devel] sbcl and file upload In-Reply-To: <8aff815905062614064295f68e@mail.gmail.com> (Keith Irwin's message of "Sun, 26 Jun 2005 14:06:43 -0700") References: <8aff8159050625174219f45969@mail.gmail.com> <8aff8159050626093122bd1ed9@mail.gmail.com> <8aff815905062614064295f68e@mail.gmail.com> Message-ID: On Sun, 26 Jun 2005 14:06:43 -0700, Keith Irwin wrote: > BTW, does CMUCL suffer from this same problem? Nope, because in CMUCL all characters are 8-bit. From keith.irwin at gmail.com Mon Jun 27 01:28:30 2005 From: keith.irwin at gmail.com (Keith Irwin) Date: Sun, 26 Jun 2005 18:28:30 -0700 Subject: [tbnl-devel] sbcl and file upload In-Reply-To: References: <8aff8159050625174219f45969@mail.gmail.com> <8aff8159050626093122bd1ed9@mail.gmail.com> <8aff815905062614064295f68e@mail.gmail.com> Message-ID: <8aff815905062618286572de3@mail.gmail.com> On 6/26/05, Edi Weitz wrote: > On Sun, 26 Jun 2005 14:06:43 -0700, Keith Irwin wrote: > > > BTW, does CMUCL suffer from this same problem? > > Nope, because in CMUCL all characters are 8-bit. > Have you seen the following? http://www.atzmueller.net/html/html-docs/net-sbcl-sockets.html Mentions bivalent streams. I wonder if it's still workable. Anyway, CMUCL works, so I guess I'll stick with that for my little prototype project. I can't see how to make SBCL work for this stuff. * If I set KMRs sockets.lisp sbcl stuff to use :external-format :latin-1, I don't get an error, but the uploaded files are corrupted. * If I set KRMs sbcl socket stream stuff to :element-type '(unsigned-byte 8), I'll have to rewrite a lot of request.lisp, I'm thinking, and other stuff, to convert to and from strings at need. In other words, read everything as raw bytes, convert to string at each step, except, say, when serving up or decoding image data. Just guesses, though. --K {} From keith.irwin at gmail.com Mon Jun 27 21:04:10 2005 From: keith.irwin at gmail.com (Keith Irwin) Date: Mon, 27 Jun 2005 14:04:10 -0700 Subject: [tbnl-devel] file upload from windows, pathname? Message-ID: <8aff815905062714048e55fb@mail.gmail.com> Folks (or, anyway, Edi)-- When I upload a file, I get a structure something like: ("file" #P"/tmp/tbnl/tbnl-10" "Water Lillies.jpg" "image/jpeg") which is just fine. Documented, after all. And this works using firefox on both linux and windows. BUT, when I use IE on windows (where else), I get: ("file" #P"/tmp/tbnl/tbnl-10" "C:\\\\Documents and Settings\\\\All Users\\\\Documents\\\\Sample Pictures\\\Water lilies.jpg" "image/pjpeg") As you can imagine, this causes a slight bit of weirdness when I try to move the file from /tmp to my asset store. Amazingly, the pictures is copied. The name is a bit long. But in IE, at least, I can't "view" the picture as it translates to images/C:/Documents.... FWIW: images are served by apache, not TBNL. Easily fixable? Or should I just try for a regex to remove everything up to the last \ or /? --K {} ps. Interestingly, firefox on windows properly escapes the slashes so the image does get rendered. From edi at agharta.de Mon Jun 27 21:25:09 2005 From: edi at agharta.de (Edi Weitz) Date: Mon, 27 Jun 2005 23:25:09 +0200 Subject: [tbnl-devel] file upload from windows, pathname? In-Reply-To: <8aff815905062714048e55fb@mail.gmail.com> (Keith Irwin's message of "Mon, 27 Jun 2005 14:04:10 -0700") References: <8aff815905062714048e55fb@mail.gmail.com> Message-ID: Hi! On Mon, 27 Jun 2005 14:04:10 -0700, Keith Irwin wrote: > When I upload a file, I get a structure something like: > > ("file" #P"/tmp/tbnl/tbnl-10" "Water Lillies.jpg" "image/jpeg") Hey! I used the same test file... :) > which is just fine. Documented, after all. And this works using > firefox on both linux and windows. > > BUT, when I use IE on windows (where else), I get: > > ("file" #P"/tmp/tbnl/tbnl-10" "C:\\\\Documents and Settings\\\\All > Users\\\\Documents\\\\Sample Pictures\\\Water lilies.jpg" > "image/pjpeg") > > As you can imagine, this causes a slight bit of weirdness when I try > to move the file from /tmp to my asset store. Amazingly, the > pictures is copied. The name is a bit long. But in IE, at least, I > can't "view" the picture as it translates to images/C:/Documents.... > > FWIW: images are served by apache, not TBNL. > > Easily fixable? There's nothing to fix, actually. The docs say "file-name (a string) is the file name sent by the browser" and that's what you see. "Fixing" this would mean to remove information. > Or should I just try for a regex to remove everything up to the last > \ or /? That's what I do. Cheers, Edi. From keith.irwin at gmail.com Mon Jun 27 22:24:17 2005 From: keith.irwin at gmail.com (Keith Irwin) Date: Mon, 27 Jun 2005 15:24:17 -0700 Subject: [tbnl-devel] file upload from windows, pathname? In-Reply-To: References: <8aff815905062714048e55fb@mail.gmail.com> Message-ID: <8aff815905062715247d1c4ec5@mail.gmail.com> >> Or should I just try for a regex to remove everything up to the last >> \ or /? > That's what I do. Okay. Will do. Ah, one's code starts out so pristine.... ;) Keith From edi at agharta.de Mon Jun 27 22:36:20 2005 From: edi at agharta.de (Edi Weitz) Date: Tue, 28 Jun 2005 00:36:20 +0200 Subject: [tbnl-devel] file upload from windows, pathname? In-Reply-To: <8aff815905062715247d1c4ec5@mail.gmail.com> (Keith Irwin's message of "Mon, 27 Jun 2005 15:24:17 -0700") References: <8aff815905062714048e55fb@mail.gmail.com> <8aff815905062715247d1c4ec5@mail.gmail.com> Message-ID: On Mon, 27 Jun 2005 15:24:17 -0700, Keith Irwin wrote: > Okay. Will do. Ah, one's code starts out so pristine.... ;) Hehe, I know that feeling... :) From stesch at no-spoon.de Tue Jun 28 07:09:44 2005 From: stesch at no-spoon.de (Stefan Scholl) Date: Tue, 28 Jun 2005 09:09:44 +0200 Subject: [tbnl-devel] file upload from windows, pathname? In-Reply-To: <8aff815905062714048e55fb@mail.gmail.com> References: <8aff815905062714048e55fb@mail.gmail.com> Message-ID: <20050628070943.GX11759@parsec.no-spoon.de> On 2005-06-27 14:04:10, Keith Irwin wrote: > ("file" #P"/tmp/tbnl/tbnl-10" "C:\\\\Documents and Settings\\\\All > Users\\\\Documents\\\\Sample Pictures\\\Water lilies.jpg" > "image/pjpeg") That's more a common web development problem with IE. Wrong Content-Type and a complete path instead of the filename. By the way: I've once seen a really stupid project management software which really saved the whole path, but not the file itself. Braindead in a heterogeneous environment with Linux, Macs, and Windows. From keith.irwin at gmail.com Tue Jun 28 15:27:26 2005 From: keith.irwin at gmail.com (Keith Irwin) Date: Tue, 28 Jun 2005 08:27:26 -0700 Subject: [tbnl-devel] file upload from windows, pathname? In-Reply-To: <20050628070943.GX11759@parsec.no-spoon.de> References: <8aff815905062714048e55fb@mail.gmail.com> <20050628070943.GX11759@parsec.no-spoon.de> Message-ID: <8aff815905062808276dce4b14@mail.gmail.com> On 6/28/05, Stefan Scholl wrote: > On 2005-06-27 14:04:10, Keith Irwin wrote: > > ("file" #P"/tmp/tbnl/tbnl-10" "C:\\\\Documents and Settings\\\\All > > Users\\\\Documents\\\\Sample Pictures\\\Water lilies.jpg" > > "image/pjpeg") > That's more a common web development problem with IE. Wrong > Content-Type and a complete path instead of the filename. Although I do a lot of web development, I have to admit it's been years since I've done any sort of file upload stuff. I think PHP takes care of it, as did some Java class I used almost five years ago. I'll have to test with an IE upload and PHP when I get into the office a bit later, but I'm almost sure I tested with IE and the filename came through without the path. You guys would happen to have the relevant regex handy, would you? ;) Time to break out the regex coach. --K > By the way: I've once seen a really stupid project management > software which really saved the whole path, but not the file > itself. > > Braindead in a heterogeneous environment with Linux, Macs, and > Windows. > > > _______________________________________________ > tbnl-devel site list > tbnl-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/tbnl-devel > From xach at xach.com Tue Jun 28 15:37:54 2005 From: xach at xach.com (Zach Beane) Date: Tue, 28 Jun 2005 11:37:54 -0400 Subject: [tbnl-devel] file upload from windows, pathname? In-Reply-To: <8aff815905062808276dce4b14@mail.gmail.com> References: <8aff815905062714048e55fb@mail.gmail.com> <20050628070943.GX11759@parsec.no-spoon.de> <8aff815905062808276dce4b14@mail.gmail.com> Message-ID: <20050628153754.GT6196@xach.com> On Tue, Jun 28, 2005 at 08:27:26AM -0700, Keith Irwin wrote: > You guys would happen to have the relevant regex handy, would you? ;) (position #\\ name :from-end t) might be a place to start. Zach