[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpprintipp] Why not use cURL ?
From: |
Thomas Harding |
Subject: |
Re: [Phpprintipp] Why not use cURL ? |
Date: |
Sat, 04 Sep 2010 19:24:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100805 Icedove/3.0.6 |
Le 03/09/2010 22:45, Gabriel David a écrit :
I was looking at your code for PHP::PRINT::IPP and wondered why you do
not use cURL <http://www.php.net/manual/en/book.curl.php>.
IPP under Windows Server 2008 requires NTLM Authentication and cURL
supports it.
cURL cannot handle IPP requests, even if they are mainly HTTP1/1 POST
request
because of several reasons :
first, IPP HTTP POST request needs a CONTENT-LENGHT header, which is
computed
from the specific IPP string ended by the 0x03 "character", immediately
followed by
the file or string.
Second, a PDF or PostScript file can have an HUGE size, which could not
be handled
because of PHP max memory settings (now far up to the initial 8Mbytes
standard,
but not infinite), so PHP:PRINT:IPP http backend takes care of file
size, add it to
the ipp command string size to complete content-lenght header, post the
HTTP headers
and IPP command string, then streams the file by strips of N kilobytes
from the beginning
to the EOF to the HTTP/IPP server, which saves for memory.
In case of computed strings to spool (eg "fpdf" output, the string
length is added directly
to the IPP string length to build http header, and they are streamed
together)
Third, cURL is written to handle "classic" GET/POST requests, also with
multiple content
(given by your browser while you have enctype="multipart/form-data" in
your web forms
to be able to upload files) for named files, but is "fixed" on classic
HTTP client behavior
with multipart-form data handling as such as "boundary:
R4anD0mstR1ng----" and so on
you can find in any mime multipart RFC documents.
This handling have nothing to do with IPP:
[http headers with content-lenght][blank line][ipp commands ending by
0x03][content to print]
[.................content-length..............................]
Fourth, my first http backend was a modified one from (BSD licensed)
Manuel Lemos
http which didn't use cURL yet. I think Manuel use cURL now, but don't
know if he
still have our "string+file spooling" hack.
I deleted my files from Manuel Lemos site because of a different point
of view on
distribution (while you can force users to register to get your files,
and upload files
to the site was very painfull (no tarballs!), and because I switched on to
GNU Savannah which offers SVN/CVS/... versioning systems, with anonymous
login
for anyone (and authenticated login for developers), and http and ftp
download areas.
I wonder when GNU Savannah will offer for Debian add-ons repository we
could fill
in ;p
So, (I think) Manuel Lemos's still develop his own http class I based on
PHP:PRINT:IPP
first for backend, and he was adding cURL handling while I began to
develop my own.
I cannot guarantee cURL parts nor Manuel's http backend itself are
still compatible with
my IPP class, and I'm not sure NTLM auth is part of RFCs for IPP allows
NTLM auth
on http backend, which would make if not a peculiarity of M$ IPP
implementation.
More, I would pass PHP:PRINT:IPP devel to a good programmer, because of
illness (too many work => nervous breakdown), and in lack of time (I'm in
the forces, so can be busied 24h a day 7 days on the week), but didn't find
any volunteer.
Last, I doubt that the M$Windows IPP server will handle your prints except
ASCII text files, because of print requests are handled directly by
client programs
through the "printer driver".
Note I can be wrong on that point.
So, you can ever either adapt Manuel's http class (I think it handles
both cURL and
NTLM auth) and/or BasicIPP yourself, with no warranty of printing
success because
of "the printer driver problem".
[to gabriel] I set ml handler to approves your mails, but didn't expect
anyone will
add you in their responses to this thread
/Gabriel David/
/address@hidden <mailto:address@hidden>/
/
/
[to all] Please subscribe to the mailing list before to post, as I'm
sometimes
offline for long periods, and I'm the only one moderator (even if gnu
moderators
seems to do the job themselves sometimes :).
It can be done through www mailman address which follow,
Or posting to
<mailto:address@hidden>
Phpprintipp mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/phpprintipp
HTH,
--
TH.