Project

General

Profile

Actions

Feature #50509

closed

Switch to jsonbody if AJAX-Call exceeds length limit

Added by Stefan Froemken over 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
Backend API
Target version:
-
Start date:
2013-07-29
Due date:
% Done:

100%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
easy
Sprint Focus:

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

Actions #1

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22655

Actions #2

Updated by Philipp Gampe over 10 years ago

  • 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.

Actions #3

Updated by Philipp Gampe over 10 years ago

  • Subject changed from Error 500 while AJAX-Call in BE to Switch to jsonbody if AJAX-Call exceeds length limit
Actions #4

Updated by Stefan Froemken over 10 years ago

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.

Actions #5

Updated by Xavier Perseguers over 10 years ago

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.

Actions #6

Updated by Gerrit Code Review over 9 years ago

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

Actions #7

Updated by Gerrit Code Review over 9 years ago

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

Actions #8

Updated by Gerrit Code Review about 9 years ago

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

Actions #9

Updated by Gerrit Code Review about 9 years ago

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

Actions #10

Updated by Benni Mack about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by Wouter Wolters almost 8 years ago

  • Target version deleted (6.2.0)
Actions #12

Updated by Thomas Mayer almost 8 years ago

The patch made it into TYPO3 via target version 7.2.0, according to https://github.com/TYPO3/TYPO3.CMS/commit/3124ebb4df25fa3712faa51e1624a2e96c38fe8e

TYPO3 6.2.x remains unfixed according to #76340 -> still defaults to 'jsonhead' for 'json' as of 6.2.25.

Actions #13

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF