Custom CGIs

Michael Sweet mike at easysw.com
Sun Dec 17 06:31:53 PST 2006


Opher Shachar wrote:
> Hello,
> I created a custom CGI and placed it in /usr/share/cups/doc.
> One functionality of the CGI is to send back files:
> I write to stdout:
>      Content-type: text/plain; charset=<either of utf-8 or iso-8859-8>
> or
>      Content-type: application/postscript
>      Content-length: <file size>
> 
> Then the file (I leave an extra newline after the headers) but on the browser side I see a blank page and eventually timeout.
> (It all works fine when sending text/html content)
> 
> Q: Does CUPS support anything but text/html from its CGIs?

Yes, of course.  You can't set the content-length, however - CUPS does
that for you...

> Another thing, the CUPS CGIs (admin.cgi, jobs.cgi ...) have a nice trait that they will ask for a new Authentication as needed.
> ex. say I authenticated as the job owner to do "Hold Job" but I need admin preveliges to to "Hold Job" on a job I don't own - I'll be ask to re-authenticate instead of getting "Not Authorized/access denied" or the likes.
> 
> Q: How can my CGI signal the CUPS Web Server to ask the User Agent (eg. InternetExplorer / FireFox) for Authentication.

The Status: header is used for this:

     Status: 401

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com




More information about the cups mailing list