Feature #50509
closed
Switch to jsonbody if AJAX-Call exceeds length limit
Added by Stefan Froemken over 11 years ago.
Updated about 6 years ago.
Description
Hello Core-Team,
I have programmed an extension on my local machine and everything works like expected. Then I push my extension to live and all AJAX-Calls to ajax.php returns an Error 500. I can activate all debugging informations in Installtool, but there is still this Error. No further informations available. So I started step-by-step debugging in Source.
The error appears at this line:
header('X-JSON: '.($this->contentFormat != 'jsonbody' ? $content : TRUE));
Maybe this part is OK for very small AJAX-Calls. But in my case I retrieve data for a table and I think the size of my JSON is too large for header. I found some information about it here:
https://www.ruby-forum.com/topic/94728
http://www.sencha.com/forum/archive/index.php/t-4352.html
http://stackoverflow.com/questions/1097651/is-there-a-practical-http-header-length-limit
For now I have change contentType from "json" to "jsonbody" and my table works again on live system:
$ref->setContentFormat('jsonbody');
In my kind of view you should deactive putting data into the header.
Stefan
- Status changed from New to Under Review
- Tracker changed from Bug to Feature
- Assignee set to Stefan Froemken
- TYPO3 Version changed from 4.7 to 6.2
Sending small data via Header saves a few bytes for small requests, thus this should be the default behavior.
Anyway, the core could be smart enough to automatically switch to jsonbody if the Header line exeeds 8190 bytes (see stackoverflow).
I am changing this to a features as I do not think that this is a TYPO3 error. The programmer should know if he sends large data, that he might run into server limits.
Let me know if you disagree.
- Subject changed from Error 500 while AJAX-Call in BE to Switch to jsonbody if AJAX-Call exceeds length limit
Hello Philipp,
I agree with you, that it may be OK to send small JSON-Strings by Header, but I disagree to make this way the default. The header way is only for small additional descriptions of the content and it can't be that we want to abuse the header way as default.
I'm wondering if this limit of 8190 bytes will always be available. I'm thinking about reverse proxies, ... that may (?) by default be configured with a lower limit. I don't have examples at hand, just a warning from my point of view that in fact relying on misusing header to save some bytes is /maybe/ not wise.
To be confirmed by going through a few of reverse proxy documentation for default settings.
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/22655
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/22655
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/22655
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/22655
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Target version deleted (
6.2.0)
- Status changed from Resolved to Closed
Also available in: Atom
PDF