Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading comments about max. size of form data #139

Closed
tillkamppeter opened this issue Jan 18, 2021 · 4 comments
Closed

Misleading comments about max. size of form data #139

tillkamppeter opened this issue Jan 18, 2021 · 4 comments
Assignees
Labels
bug Something isn't working priority-low
Milestone

Comments

@tillkamppeter
Copy link
Contributor

The function papplClientHTMLStartForm() tells in acomment that the maximum attachment file size is 1 MB, but MAX_FILE_SIZE is set to 64 kB.

papplClientGetForm() tells in a comment that it reads up to 2 MB but uses a buffer of only 64 kB, filling up this buffer once and parsing only this data. It would need to use a 2 MB buffer or fill the 64 kB several times.

@michaelrsweet michaelrsweet self-assigned this Jan 18, 2021
@michaelrsweet michaelrsweet added bug Something isn't working priority-low labels Jan 18, 2021
@michaelrsweet
Copy link
Owner

@tillkamppeter OK, I think the original code (from mOAuth) allows up to 2MiB but when I moved it here I reduced the limit. Will make sure everything is consistent between them.

Do you need support for files larger than 64k?

@michaelrsweet michaelrsweet added this to the Stable milestone Jan 18, 2021
@tillkamppeter
Copy link
Contributor Author

I use this functionality for the user to add PPD files to the PostScript Printer Application, so that he can use it with printers which are not supported by the built-in PPDs, for example if the printer's PPD is under a non-free license.
PPDs easily can be larger than 64 kB, and I also allow for uploading more than one PPD at a time.

As papplClientGetForm() does not allow upload of multiple files with a single widget I have done my own replacement in the PostScript Printer Application. It uses a 32 kB buffer and fills it, parses the content, fills it again , ... until passed through all data, so I am somehow streaming the data. This allows even uploading files of several GB (like a Ubuntu Desktop ISO) and this even with your papplClientHTMLStartForm() function which sets MAX_FILE_SIZE to 64 kB.

There can be also other types of files to be uploaded into a Printer Application which are bigger than 64 kb: Firmware files, color profiles, or even printing via web interface.

@tillkamppeter
Copy link
Contributor Author

See the ps_system_web_add_ppd() function in this commit.

@michaelrsweet
Copy link
Owner

I updated the code to dynamically allocate the data buffer, with a maximum size of 2MB.

[master 57c9830] Fix function to support large files (Issue #139)

[v1.0.x 3c3c1fb] Fix function to support large files (Issue #139)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-low
Projects
None yet
Development

No branches or pull requests

2 participants