* [9fans] httpd scripting @ 2003-06-01 0:47 Skip Tavakkolian 2003-06-01 13:27 ` Kenji Arisawa 2003-06-02 11:55 ` matt 0 siblings, 2 replies; 19+ messages in thread From: Skip Tavakkolian @ 2003-06-01 0:47 UTC (permalink / raw) To: 9fans Has anyone done any deep thinking on this? I've just started looking into it. I have looked at Pegasus, but I need something a little more specialized. My own preference is for an awk-like environment but nothing definite yet. I want to process code fragments inside html docs, the same thing as jsp,asp,php, etc. P.S. Yes, I could go with Apache or something else on a different OS, but I don't want to. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 0:47 [9fans] httpd scripting Skip Tavakkolian @ 2003-06-01 13:27 ` Kenji Arisawa 2003-06-01 14:24 ` Skip Tavakkolian 2003-06-02 11:55 ` matt 1 sibling, 1 reply; 19+ messages in thread From: Kenji Arisawa @ 2003-06-01 13:27 UTC (permalink / raw) To: 9fans Hello, >Has anyone done any deep thinking on this? I've just started >looking into it. I have looked at Pegasus, but I need something a >little more specialized. My own preference is for an awk-like environment >but nothing definite yet. I want to process code fragments inside >html docs, the same thing as jsp,asp,php, etc. I think the solution is (html scanner) + (bidirectional pipe to a program) though Pegasus does not offer such a scanner yet. Sorry if I misunderstand what you say. Kenji Arisawa ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 13:27 ` Kenji Arisawa @ 2003-06-01 14:24 ` Skip Tavakkolian 2003-06-01 15:28 ` boyd, rounin 2003-06-01 20:56 ` Kenji Arisawa 0 siblings, 2 replies; 19+ messages in thread From: Skip Tavakkolian @ 2003-06-01 14:24 UTC (permalink / raw) To: 9fans > I think the solution is > (html scanner) + (bidirectional pipe to a program) > though Pegasus does not offer such a scanner yet. I like that. Also, I am (sort of) considering a fs for scripting, mounted in httpd's namespace; Not sure how the user's client context would be forwarded to the fs (cookies, and the like). ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 14:24 ` Skip Tavakkolian @ 2003-06-01 15:28 ` boyd, rounin 2003-06-01 14:58 ` Skip Tavakkolian 2003-06-01 20:56 ` Kenji Arisawa 1 sibling, 1 reply; 19+ messages in thread From: boyd, rounin @ 2003-06-01 15:28 UTC (permalink / raw) To: 9fans > .... (cookies, and the like). those things should be blocked. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 15:28 ` boyd, rounin @ 2003-06-01 14:58 ` Skip Tavakkolian 2003-06-01 15:59 ` boyd, rounin 0 siblings, 1 reply; 19+ messages in thread From: Skip Tavakkolian @ 2003-06-01 14:58 UTC (permalink / raw) To: 9fans >> .... (cookies, and the like). > > those things should be blocked. The only legitimate use I can think of (for a server) is keeping track of a session (identifying a session). ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 14:58 ` Skip Tavakkolian @ 2003-06-01 15:59 ` boyd, rounin 0 siblings, 0 replies; 19+ messages in thread From: boyd, rounin @ 2003-06-01 15:59 UTC (permalink / raw) To: 9fans > The only legitimate use I can think of .... i don't think it's 'legitimate use' ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 14:24 ` Skip Tavakkolian 2003-06-01 15:28 ` boyd, rounin @ 2003-06-01 20:56 ` Kenji Arisawa 1 sibling, 0 replies; 19+ messages in thread From: Kenji Arisawa @ 2003-06-01 20:56 UTC (permalink / raw) To: 9fans Hello, >Also, I am (sort of) considering a fs for scripting, mounted >in httpd's namespace; Fs idea may be interesting but might bring other problems. Kenji Arisawa ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-01 0:47 [9fans] httpd scripting Skip Tavakkolian 2003-06-01 13:27 ` Kenji Arisawa @ 2003-06-02 11:55 ` matt 2003-06-02 12:12 ` David Butler 2003-06-02 12:35 ` Charles Forsyth 1 sibling, 2 replies; 19+ messages in thread From: matt @ 2003-06-02 11:55 UTC (permalink / raw) To: 9fans Skip Tavakkolian wrote: >Has anyone done any deep thinking on this? I've just started >looking into it. I have looked at Pegasus, but I need something a >little more specialized. My own preference is for an awk-like environment >but nothing definite yet. I want to process code fragments inside >html docs, the same thing as jsp,asp,php, etc. > as someone who uses PHP (and previously ASP) professionally - don't 8) RC and friends is enough if want awk then use awk 8) as for cookies, headers etc. you just need a quick script to chuck the request into the environment (which is what PHP does) I did write a script to do it once http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&threadm=015d01c22ed3%24fcc596e0%246501a8c0%40KIKE&rnum=1&prev=/groups%3Fq%3Dgroup:comp.os.plan9%2Bhttpd%2Bmatt%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26selm%3D015d01c22ed3%2524fcc596e0%25246501a8c0%2540KIKE%26rnum%3D1 but I seem to have lost the code during a re-install (curses for putting the magic directory outside of /usr ) All you really need to do is split the headers on the first colon : ([^:]+): ?(.*) (after skipping past the first line) and then pop the results into the environment echo $match_2 > /env/$match_1 when you run out of matches the rest of stdin is the body & you might even be able to trust the Content-Length value ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 11:55 ` matt @ 2003-06-02 12:12 ` David Butler 2003-06-02 16:22 ` matt 2003-06-02 12:35 ` Charles Forsyth 1 sibling, 1 reply; 19+ messages in thread From: David Butler @ 2003-06-02 12:12 UTC (permalink / raw) To: 9fans I did a lot of work in the http area on Plan 9, back on version 2 of the system. I took the approach that anything is executable (compiled) instead of scripting. It was fast and very flexible. Perhaps I can see what it takes to get it on version 4 and make it available... David ----- Original Message ----- From: "matt" <matt@proweb.co.uk> To: <9fans@cse.psu.edu> Sent: Monday, June 02, 2003 6:55 AM Subject: Re: [9fans] httpd scripting > Skip Tavakkolian wrote: > > >Has anyone done any deep thinking on this? I've just started > >looking into it. I have looked at Pegasus, but I need something a > >little more specialized. My own preference is for an awk-like environment > >but nothing definite yet. I want to process code fragments inside > >html docs, the same thing as jsp,asp,php, etc. > > > > as someone who uses PHP (and previously ASP) professionally - don't 8) > > RC and friends is enough > > if want awk then use awk 8) > > as for cookies, headers etc. you just need a quick script to chuck the > request into the environment (which is what PHP does) > > I did write a script to do it once > > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&threadm=015d01c22ed3%24fcc596e0%246501a8c0%40KIKE&rnum=1&prev=/groups%3Fq%3Dgroup:comp.os.plan9%2Bhttpd%2Bmatt%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26selm%3D015d01c22ed3%2524fcc596e0%25246501a8c0%2540KIKE%26rnum%3D1 > > but I seem to have lost the code during a re-install (curses for putting > the magic directory outside of /usr ) > > All you really need to do is split the headers on the first colon : > ([^:]+): ?(.*) > > (after skipping past the first line) > and then pop the results into the environment > > echo $match_2 > /env/$match_1 > > when you run out of matches the rest of stdin is the body & you might > even be able to trust the Content-Length value > > > > > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 12:12 ` David Butler @ 2003-06-02 16:22 ` matt 0 siblings, 0 replies; 19+ messages in thread From: matt @ 2003-06-02 16:22 UTC (permalink / raw) To: 9fans David Butler wrote: >I did a lot of work in the http area on Plan 9, back on >version 2 of the system. I took the approach that anything >is executable (compiled) instead of scripting. It was fast >and very flexible. Perhaps I can see what it takes to get >it on version 4 and make it available... > >David > my only beef with ip/httpd is that it maps URIs to filenames (not that it keeps me awake at night) I've got over 500,000 URIs on one of my sites and, as such, mapping them, even via namespaces would be the wrong approach the world is an easier place if http://www.thebigchoice.com/Graduate_Jobs/IT_and_Management_Systems/York is the URI instead of http://www.thebigchoice.com/magic/show_jobs?section=Graduate_Jobs&job_section=IT_and_Management_Systems&area=York esp. when you factor in relative URIs in the resulting HTML m ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 11:55 ` matt 2003-06-02 12:12 ` David Butler @ 2003-06-02 12:35 ` Charles Forsyth 2003-06-02 13:08 ` matt 1 sibling, 1 reply; 19+ messages in thread From: Charles Forsyth @ 2003-06-02 12:35 UTC (permalink / raw) To: 9fans >>RC and friends is enough i did found that sufficient when i did a plan 9 httpd years ago, probably before asp let alone php had appeared. i used echo or cat and here documents quite a bit. i still think it seems better to generate the html within the (obviously) shared dynamic environment provided by the rc script rather than have lots of executable fragments embedded in html. it needn't be rc of course. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 12:35 ` Charles Forsyth @ 2003-06-02 13:08 ` matt 2003-06-02 13:51 ` Charles Forsyth ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: matt @ 2003-06-02 13:08 UTC (permalink / raw) To: 9fans Charles Forsyth wrote: >>>RC and friends is enough >>> >>> > >i did found that sufficient when i did >a plan 9 httpd years ago, probably before asp let alone php >had appeared. i used echo or cat and here documents quite a bit. >i still think it seems better to generate the html >within the (obviously) shared dynamic environment provided by >the rc script rather than have lots of executable fragments embedded in html. >it needn't be rc of course. > the "code fragments in the HTML" model is not very scalable in fact, content management becomes a total nightmare you have to move from "how is the HTML going to display the results of executing this code" to "what HTML should the code produce" It's like it starts you off at the wrong layer of abstraction ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 13:08 ` matt @ 2003-06-02 13:51 ` Charles Forsyth 2003-06-02 15:38 ` Ian Broster 2003-06-03 9:42 ` Robby 2 siblings, 0 replies; 19+ messages in thread From: Charles Forsyth @ 2003-06-02 13:51 UTC (permalink / raw) To: 9fans i looked at the code, and the rule i used was simply that if the url for GET and POST corresponded to an executable file-- as gdb suggested not just an rc file, though i did use rc for many examples-- httpd forked the name space (having originally secured it) and environment, put some of the parsed data in the environment (could have served it up in files), optionally sent an HTTP reply header, and ran the program. if the executable file's suffix was .http, it was assumed to generate its own HTTP headers, otherwise httpd provided whatever was appropriate to the file's suffix. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 13:08 ` matt 2003-06-02 13:51 ` Charles Forsyth @ 2003-06-02 15:38 ` Ian Broster 2003-06-02 16:12 ` matt ` (2 more replies) 2003-06-03 9:42 ` Robby 2 siblings, 3 replies; 19+ messages in thread From: Ian Broster @ 2003-06-02 15:38 UTC (permalink / raw) To: 9fans > the "code fragments in the HTML" model is not very scalable > > in fact, content management becomes a total nightmare I've come to the conclusion that neither 'code in HTML' nor 'HTML in code' are very good! Neither are easy to read, quotes mess everything up and it's hard to debug. My thought is to try to raise the abstraction higher. Here's how I'd like to code a server generated page. int some_data[5][5]; /*eg*/ create_my data(some_data); ... { new_web_page(template); add(some_data, how_to_add_intgers); add(sometext, how_to_add_text); ... done(); /* composes the page and writes it out*/ } Note that the ordering is not 'linear'. It doesn't matter which order the add() calls come. the 'how_to_add_text' things (whatever they are?) describe how the thing is presented in the markup language. Perhaps this has overtones of a Tk-like interface. Perhaps it's more object oriented. One day, I'd like to try to find the time to investigate. Maybe something already exists? ian ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 15:38 ` Ian Broster @ 2003-06-02 16:12 ` matt [not found] ` <e38733ba634d64e975019d2c0de81b2b@proxima.alt.za> 2003-06-02 17:55 ` Joel Salomon 2 siblings, 0 replies; 19+ messages in thread From: matt @ 2003-06-02 16:12 UTC (permalink / raw) To: 9fans > > >My thought is to try to raise the abstraction higher. >Here's how I'd like to code a server generated page. > >int some_data[5][5]; /*eg*/ >create_my data(some_data); >... >{ > new_web_page(template); > add(some_data, how_to_add_intgers); > add(sometext, how_to_add_text); > ... > done(); /* composes the page and writes it out*/ >} > > that's kind of how I do it <? $this->add_head_item('<link href="/cascading_menu.css" rel="stylesheet" type="text/css">'); $this->add_head_item('<link href="/cascading_menu_colours.css" rel="stylesheet" type="text/css">'); $this->add_h1('useful links'); $this->add_anchor('plan 9 homepage', array('href'=>'http://plan9.bell-labs.com/plan9', 'target'=>'_blank'); echo $this->get(); ?> and out pops a valid, well formatted html document I've added a few things to it over that last 6 months such that this site http://www.bigchoicemobilephones.com took about a week to build from scratch the body content sits in a directory tree outside of the webspace & the php pulls it all together ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <e38733ba634d64e975019d2c0de81b2b@proxima.alt.za>]
* Re: [9fans] httpd scripting [not found] ` <e38733ba634d64e975019d2c0de81b2b@proxima.alt.za> @ 2003-06-02 16:15 ` spam 0 siblings, 0 replies; 19+ messages in thread From: spam @ 2003-06-02 16:15 UTC (permalink / raw) To: 9fans > Have you seen tclhtppd? It's on sourceforge. Have now. Thanks. Seems to be quite well thought out, although it is basically 'code in HTML', the separation of a template file from the code seems sensible. ian ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 15:38 ` Ian Broster 2003-06-02 16:12 ` matt [not found] ` <e38733ba634d64e975019d2c0de81b2b@proxima.alt.za> @ 2003-06-02 17:55 ` Joel Salomon 2 siblings, 0 replies; 19+ messages in thread From: Joel Salomon @ 2003-06-02 17:55 UTC (permalink / raw) To: 9fans On Mon, 2 Jun 2003, Ian Broster wrote: > > Perhaps this has overtones of a Tk-like interface. > Perhaps it's more object oriented. One > day, I'd like to try to find the time to investigate. > Maybe something already exists? > > ian > This feels similar to XML+DOM, which may be too buzzword-compliant for plan9, but was invented for this problem domain. --Joel ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-02 13:08 ` matt 2003-06-02 13:51 ` Charles Forsyth 2003-06-02 15:38 ` Ian Broster @ 2003-06-03 9:42 ` Robby 2003-06-03 12:50 ` William Ahern 2 siblings, 1 reply; 19+ messages in thread From: Robby @ 2003-06-03 9:42 UTC (permalink / raw) To: 9fans In article <20030602163818.316ebbf5.spam@broster.co.uk>, spam@broster.co.uk (Ian Broster) writes: >> the "code fragments in the HTML" model is not very scalable >> >> in fact, content management becomes a total nightmare > > I've come to the conclusion that neither 'code in HTML' nor 'HTML > in code' are very good! Neither are easy to read, quotes mess > everything up and it's hard to debug. > > My thought is to try to raise the abstraction higher. > Here's how I'd like to code a server generated page. > > int some_data[5][5]; /*eg*/ > create_my data(some_data); > ... > { > new_web_page(template); > add(some_data, how_to_add_intgers); > add(sometext, how_to_add_text); > ... > done(); /* composes the page and writes it out*/ > } > > > Note that the ordering is not 'linear'. It doesn't matter which > order the add() calls come. the 'how_to_add_text' things > (whatever they are?) describe how the thing is presented in > the markup language. > > Perhaps this has overtones of a Tk-like interface. > Perhaps it's more object oriented. One > day, I'd like to try to find the time to investigate. > Maybe something already exists? > > ian This kind of reminds me of a posting to comp.compilers, which I love to whip out whenever somebody wants to understand function pointers or variable arguments. I don't know if this "just" works in plan9, though. I haven't had the need to try something like this out yet. Robby > From telnet@wagner.Princeton.EDU.composers Wed Jul 8 06:40:19 1998 > Newsgroups: comp.compilers > Subject: Re: writing an assembler! > Date: 8 Jul 1998 01:40:01 -0400 > Organization: Chemistry Department, Princeton University > Message-ID: <98-07-062@comp.compilers> > Keywords: macros, design > Lines: 70 > In article <98-07-005@comp.compilers>, "Dr Richard A. O'Keefe" <ok@atlas.otago.ac.nz> writes: > > These days, my language of choice for doing this would be Lisp or Ada > > (sensible macros are about *trees*, not strings!) but you can > > certainly use C as an assembler quite effectively. > > [It's a disgusting hack, but it's a great disgusting hack. -John] > > You can get away with tree-like behavior in C if you use varargs stuff. > I'll risk my reputation (:-)) by admitting to an even more disgusting hack: > --- > void new_section(char *title, char *img_name, int h, int w) { > emit(html_list, > html_p, > html_hr, > html_br, > html_region, "center", > html_region, "h1", > html_text, title, > html_tag, "img", > html_param, "src", html_string, fname, > html_param, "height", html_text, h, > html_param, "width", html_text, w, > 0, > 0); > } > --- > typedef void (*html_func)(va_list *); > > void emit(html_func first, ...) { > va_list ap; > > va_start(ap, first); > (*first)(&ap); > va_end(ap); > } > > void html_list(va_list *ap) { > html_func f; > > while (1) { > f = va_arg(ap, html_func); > if (f == 0) break; > > (*f)(ap); > } > } > > [etc] > --- > > A disgusting hack? Absolutely. > > But it's also an order of magnitude more powerful than any other > dynamic HTML tool I've worked with, and it only took me an hour or so > to implement. > --------------------------------------------------------------------------- > Tim Hollebeek > email: tim@wfn-shop.princeton.edu > URL: http://wfn-shop.princeton.edu/~tim > > [Wow, that's loathsome. I really like it. -John] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] httpd scripting 2003-06-03 9:42 ` Robby @ 2003-06-03 12:50 ` William Ahern 0 siblings, 0 replies; 19+ messages in thread From: William Ahern @ 2003-06-03 12:50 UTC (permalink / raw) To: 9fans From telnet@wagner.Princeton.EDU.composers Wed Jul 8 06:40:19 1998 Newsgroups: comp.compilers > You can get away with tree-like behavior in C if you use varargs stuff. > I'll risk my reputation (:-)) by admitting to an even more disgusting hack: > --- > void new_section(char *title, char *img_name, int h, int w) { > emit(html_list, > html_p, > html_hr, > html_br, > html_region, "center", > html_region, "h1", > html_text, title, > html_tag, "img", > html_param, "src", html_string, fname, > html_param, "height", html_text, h, > html_param, "width", html_text, w, > 0, > 0); > } <snip> > > A disgusting hack? Absolutely. > > But it's also an order of magnitude more powerful than any other > dynamic HTML tool I've worked with, and it only took me an hour or so > to implement. > --------------------------------------------------------------------------- this is very similar to XSL: trees, nodes, concept of tags built into language. c/o xsltproc from libxml2 for an XSLT processor, and zvon.org for really good tutorials. the beauty of XSL is that you can cleanly separate your content production logic from your presentation logic. - Bill ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2003-06-03 12:50 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-06-01 0:47 [9fans] httpd scripting Skip Tavakkolian 2003-06-01 13:27 ` Kenji Arisawa 2003-06-01 14:24 ` Skip Tavakkolian 2003-06-01 15:28 ` boyd, rounin 2003-06-01 14:58 ` Skip Tavakkolian 2003-06-01 15:59 ` boyd, rounin 2003-06-01 20:56 ` Kenji Arisawa 2003-06-02 11:55 ` matt 2003-06-02 12:12 ` David Butler 2003-06-02 16:22 ` matt 2003-06-02 12:35 ` Charles Forsyth 2003-06-02 13:08 ` matt 2003-06-02 13:51 ` Charles Forsyth 2003-06-02 15:38 ` Ian Broster 2003-06-02 16:12 ` matt [not found] ` <e38733ba634d64e975019d2c0de81b2b@proxima.alt.za> 2003-06-02 16:15 ` spam 2003-06-02 17:55 ` Joel Salomon 2003-06-03 9:42 ` Robby 2003-06-03 12:50 ` William Ahern
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).