Project

General

Profile

Actions

Bug #7788

open

Signal with big string does not trigger the fallback function

Added by Samuel Quevauvillers over 3 years ago. Updated over 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10/19/2020
Due date:
% Done:

0%

Estimated time:

Description

Context :
I want to get back from the client a dynamic picture (openlayer map) as text ("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...")

How I did:
I use a signal and a slot to retrieve the data from the image as text with some JS with the slot.setJavaScript(...)
Then the dispatch function(std::string) does his work with the received string.

Problem :
It works with a small string (or integer and other types).
It does not work with a big string. The signal is emitted (a POST request with the whole data is sent from the client to the server), but the dispatch function is not reached.

Is there a std::string limitation within Wt ?

compiled with Wt 4.4.0

Actions #1

Updated by Samuel Quevauvillers over 3 years ago

After some tries, it blocks the request if the text length is between 120 000 and 122 500 chars.

(precision, it's it JSlignal and JSlot)

Actions #2

Updated by Roel Standaert over 3 years ago

Between? So you mean that when it's over 112500 chars it does work?

There is a request size limitation (<max-request-size> in wt_config.xml), and a form data size limitation (<max-formdata-size>).

I think that a WResource may be more appropriate though?

Actions #3

Updated by Samuel Quevauvillers over 3 years ago

Sorry I mean it will work if under 120 000 and won't if greater than 122500, I don't know the exact limit, I was trying to find it out to be able to get a tip;

As this is a POST request I will try the <max-formdata-size> on monday, thanks for the tip.

How should a WResource could work ? does it will work from client to server ?

Actions #4

Updated by Roel Standaert over 3 years ago

You will also need to make sure <max-request-size> is large enough. Both max-request-size and max-formdata-size apply here.

With WResource there's a bit more work involved. You'd have to create a WResource, implement its handleRequest function, and then on the client side actually execute the necessary JavaScript to send a POST request to that resource.

Actions #5

Updated by Samuel Quevauvillers over 3 years ago

Well the <max-request-size> and <max-formdata-size> did not resolve my problem...
I will try the WResource way. Do you have example on how generate the POST request ? Should I make my own ajax post request ? The doc about WResource is quite small...
Thank you

Actions #6

Updated by Samuel Quevauvillers over 3 years ago

WResource was too much time consuming to implement...
I did not find a good example to handle requests + WRresource.

So I used a workaround, as I can get a fixed number of string size working, I split the whole data by sending in several chunk. And worked...

Actions

Also available in: Atom PDF