Re: FastCGI protocol and http headers
Jose Adriano Baltieri <jabaltie-a/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Organization | UNIMEP |
| Message-ID | <[email protected]> |
Jason P Sage wrote: Hello Jason Thank you for your answer ! You were very kind. [Jason Peter Sage] I have found in my REGULAR CGI programming that I have much more flexibility and control making my own headers and using what is known as NON-PARSED HEADER CGI. This is done by simply naming your CGI application something like nph-myprogram versus myprogram. Additionally, this MIGHT already work in FAST CGI as well. This MIGHT in theory, tell the WEBSERVER (if it thinks fastcgi is in fact cgi) to NOT parse the headers at all just from the filename. There's simply no trick with FastCGI : put your desired headers on the response. Http server will mix it with its own headers. I do not KNOW the answer – but – I DO know I like working with nph- (non parsed header) CGI – as it gives me complete control of what gets sent OUT, and as for what comes in, well.. the web server is expected (in CGI any way as far as I know) is given the job of taking the incoming header and data and creating that wonderful CGI environment for us… and it sets up that temporary stream for reading in posts as well in the case of a post versus get form method. Note also – I only have experience with http url form encoded applications (or whatever its called) HTML, HTML FORMS, and spitting out HTML back to the client J You may want to have a look at something called http file upload. It's a FORM with POST method and special encoding type : MULTIPART/FORM-DATA. Using it your script or CGI may receive a file (or any # of files) as if they were form fields. Very nice. However, you'll have some work to parse stdin cause it comes in as a MULTIPART MIME MESSAGE. In your case (CGI) I guess you'll have plenty of tools to parse it. However, in my case, with my own FastCGI server, I'm having to do it on my own :-( This is where I'm stucked right now. [Jason Peter Sage] You might find the same here is true for FAST CGI. It may possibly grab the incoming headers and make the data available via its API, and then going out – well – back to what I wrote above. With FastCGI all the data that comes in to a CGI also comes in via TCP/IP records. This is no problem. The headers that the client submited are coming in OK. No problem here. · The application wants a special content-type setting [Jason Peter Sage] I only support ONE so far.. that long name.. something like xxx-decode-http/form embedded/application http or SOMETHING long and cryptic that means – HTML support, with forms both POST and GET. NOW I DO NOT know how to hand fancy CGI invoked file transfers yet, which I wish I did – then I could dispatch Pictures, ZIP files etc or at LEAST accept the uploads of files. That I can’t do yet. Suppose you have a folder of pictures of all of your students and teachers (you're an University like us). Your script then decides to send a picture, which is a jpg image file, to the browser. Then your script (CGI) add this header : Content-Type: image/jpeg (instead of the usual Content-Type: text/html) and, reads that file echoing it back as the response of the CGI. IOW, instead of the HTML, you put the image file raw binary data. I have seen that some http servers have something special for this occasion : they have a special http header called X-SENDFILE. Then your script may simply add this header, without having to re-read the image file again. This I have seen on Apache, Lighthttpd and Abyss. · The application needs to stuff a customized Pragma http header [Jason Peter Sage] This I wish I knew what you were talking about… I don’t even know what pragma means… yup I admit it! J Sounds scary though. A pragma header, AFAIK, is simply a customized header. I use it to add a header of my own telling how much time the transaction took within the CGI (or script) process. Then, on the client side, I can calculate the total elapsed time, the time within the script I have from the headers and finally, the "environmental time" which would be all of the other times (switch / cable etc etc). Thanks in advance 4 your support ! [Jason Peter Sage] I wish I had more information to offer - … well I kind of do – the header formats and some code snips. Just ask! Thank you ! BTW – You know who I am and I KNOW you have done a wonderful job so far and have made a lot of progress in a short amount of time!!!! GREAT JOB! Thank you again ! Jason -- Obrigado, ------------------------------------------------------------------------------ Jose Adriano Baltieri - Analista de Sistemas DTI - CENTRO - UNIMEP - Universidade Metodista de Piracicaba PIRACICABA - SP - Brasil - Fone : (19) 3124-1858 ------------------------------------------------------------------------------ -- Obrigado, ------------------------------------------------------------------------------ Jose Adriano Baltieri - Analista de Sistemas DTI - CENTRO - UNIMEP - Universidade Metodista de Piracicaba PIRACICABA - SP - Brasil - Fone : (19) 3124-1858 ------------------------------------------------------------------------------ ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/