3

CUPS implements its own web server to host CGI programs on http://localhost:631

server: https://github.com/apple/cups/blob/master/cups/http.c

CGI pages: https://github.com/apple/cups/tree/master/cgi-bin

Creating a web server just for a printing daemon seems like duplicate code and bloat that might lead to code harder to maintain and possible creation of bugs.

Why an actual httpd daemon like Apache is not used?

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
Mateus
  • 49
  • 8

2 Answers2

1

CUPS uses the Internet Printing Protocol (IPP) for transferring jobs from print clients to print servers (and potentially to printers, if these support IPP).

IPP is based on HTTP.
But IPP is not the same as HTTP.

Also, the CUPS web server is not the same as the CUPS printing daemon. You can disable the web interface completely by putting WebInterface No into your cupsd.conf.

Using Apache or any other HTTP daemon would not so much unbloat CUPS: because these daemons do not talk IPP, and they do not provide any functions as a print server. Therefore, adding them to CUPS just for the web interface would rather bloat up CUPS!

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
  • Interesting if it's possible to use CUPS as a small webserver with CGI. If yes, this will make CUPS a most widely deployed web server in the world. Also on Ubuntu (and probably other distros) is already installed a BusyBox with httpd which supports CGI. So for example if CUPS can use it then maybe we can even make it even smaller – Sergey Ponomarev Jun 09 '21 at 09:32
  • Interesting that you can't call the CGI program directly but they are executed from https://github.com/OpenPrinting/cups/blob/master/scheduler/client.c#L1124 I.e. there is a mapping `/jobs` to `cgi-bin/jobs.cgi`. The CGI programs are located in /usr/lib/cups/cgi-bin You can't use Perl/Bash scripts there, only compiled programs. – Sergey Ponomarev Jan 20 '22 at 13:38
1

I want the CUPS web server to run PHP so I can do a few print and scan tasks with it without installing another web server.

user178167
  • 43
  • 2
  • 7