[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http_url_post and CGIDEV2



Houghton, Steve wrote:
>     in the code.  Is there a way to use the CGIDEV2 updHtmlVar/wrtSection
>    procedures to create the XML buffer and instead of using AppHtmlToStmf
>    to write to the IFS, make gXml = to the HTML buffer?

CGIDEV2 has never provided a way to get a pointer to it's HTML buffer -- 
someone else asked about this at one time (Jon Paris, I think?) -- 
obviously, you can modify CGIDEV2 as Nick did -- if you do use Nick's 
code, please make sure you call TS_free() to release the memory when 
you're done.

The other way, of course, is to use CGIDEV2's routines to write to a 
stream file (AppHtmlToStmf or WrtHtmlToStmf) and then call 
http_url_post_stmf(). HTTPAPI does provide a rotuine called 
http_tempfile() that will generate a unique temporary file name, you 
could generate the temp file name, then call one of the xxxHtmlToStmf() 
routines to write to the temp file, then call http_url_post_stmf() to 
send it off...

There are pros and cons to both methods...

The stmf method is probably slower... though I don't know how much.  You 
might not even notice it...  but will work with stock versions of CGIDEV2

The pointer method requires modifying CGIDEV2 (as Nick demonstrates) but 
is probably faster.  You just have to remember to re-modify CGIDEV2 each 
time you update it.  If you have multiple machines, or want to 
distribute your code to customers, you need make sure that they all have 
a modified version of CGIDEV2, which can be a real nightmare to support. 
  But probably doesn't matter much if this is for one application on one 
machine.

So... pros and cons to each method.

Personally I've been thinking quite often that I need to write my own 
templating engine...   CGIDEV2's support isn't great, and there's stuff 
about it that I don't like, and it'd be hard to change at this point. I 
could write my own templating tool and add it to HTTPAPI, that'd make 
things simpler...    but who knows if I'll ever get around to it?
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------