ipp icon indicating copy to clipboard operation
ipp copied to clipboard

Do not encode data, keep as buffer

Open StefanScherer opened this issue 7 years ago • 4 comments

I'm using the ipp module to download print documents. This is one of the seldom cases where the module fills obj.data. Unfortunately the data was corrupted and eg. a PDF file couldn't be downloaded correctly.

Keeping the data in a buffer solves the problem. Instead of encode the data with the encoding for the IPP header I just slice the buffer at the position after the IPP header.

StefanScherer avatar Feb 01 '18 21:02 StefanScherer

Interesting.

This change will break someone that was depending on it returning the decoded string though. We will need to do a major version bump.

The relevant definitions from the spec:

data = OCTET-STRING
BYTE = %x00-FF
OCTET-STRING = *BYTE

https://tools.ietf.org/html/rfc2910#section-3.2

So, hmm. I guess that looks like a Buffer. 🤔

Does it throw an error when it tries to decode?

williamkapke avatar Feb 20 '18 21:02 williamkapke

@williamkapke FWIW, the more recent/relevant reference is in RFC 8010 now: https://tools.ietf.org/html/rfc8010#section-3.2

:)

michaelrsweet avatar Feb 20 '18 22:02 michaelrsweet

@michaelrsweet ah right! Thanks- it's worth a lot!

williamkapke avatar Feb 20 '18 22:02 williamkapke

No error is thrown during the decode. The data (eg. PDF) was corrupt.

StefanScherer avatar Mar 01 '18 10:03 StefanScherer