0

Has anyone got this issue with MAX_ENTITY_SIZE? I am fighting with this for quite awhile now. I hope I am just doing something stupid or somebody found a solution for this.

I am using G-WAN 4.2.7 on Ubuntu 64bit latest version.

Here is a test case. Just paste any text on textarea then click submit. If its lesser than 4KB (Or less than 3.2KB) it will work fine. If its greater than 4KB it will return with a 404 not found but it should work since I set the MAX_ENTITY_SIZE to 200KB.

#include "gwan.h" // G-WAN exported functions
#include <string.h>

int main(int argc, char *argv[])
{
    xbuf_t *reply = get_reply(argv);    
    int *entity = (int*)get_env(argv, MAX_ENTITY_SIZE);

    char *text = NULL;
    get_arg("stext=", &text, argc, argv);
    if(text) // Check if text exist.
        xbuf_xcat(reply, "Text: %s<br/><br/>%d", text, strlen(text));

    static char form[] = 
        "<form method=\"post\">"
            "<textarea name=\"stext\"></textarea><br/>"
            "<input name=\"button\" type=\"submit\" value=\"Submit\" />"
        "</form><br/>Entity Size: %d";
    xbuf_xcat(reply, form, *entity);

    return 200;
}

Dont forget to increase the MAX_ENTITY_SIZE limit:

int init(int argc, char *argv[])
{
   int *entity = (int*)get_env(argv, MAX_ENTITY_SIZE);
   *entity = 200 * 1024;
   return 0;
}

UPDATE:

Tested on Ubuntu 10.10 with same issue.

Gil
  • 3,279
  • 1
  • 15
  • 25
Richard Heath
  • 349
  • 3
  • 12
  • 1
    G-WAN v4.2.19 has been shipped with enhanced entity.c and entity_size.c examples which have been tested with a 1.7 MiB upload. Just give it a try. – Gil Feb 19 '13 at 17:45
  • Gil it's working perfectly now. Thank you G-WAN for the update. – Richard Heath Feb 19 '13 at 19:49
  • Richard, I am pretty sure @Gil is Gwan, good that he monitors stack overflow – jasonk Mar 05 '13 at 21:33
  • In fact, the the G-WAN site, we invite G-WAN users to use stackoverflow - so it is natural to attempt to answer their questions... – Gil Mar 06 '13 at 07:49

3 Answers3

0

I am running into the same issue.

From my own tests you can POST a file up to 3663 bytes, but any POST 3664 bytes and larger will return a 404 regardless of the MAX_ENTITY_SIZE value. Not sure why the arbitrary limit of 3663 is used...

It should be possible to write a custom handler to get around this issue, but that is an annoyance at best. Hopefully we can get a fix soon.

bghoward
  • 9
  • 1
  • The error is *"413 Request-URI Too Long"* or *"414 Request Entity Too Large"* (rather than *"404 Not found"*). Those accounts created only to pollute the Q&A are not useful. Please stop it. – Gil Feb 14 '13 at 10:15
  • @Gil The error that we are getting is 404 Not found. When you set the MAX_ENTITY_SIZE greater than 4kb and post an entity greater than 4kb. If you leave the default MAX_ENTITY_SIZE it will return the correct message 413 and 414. – Richard Heath Feb 14 '13 at 15:23
0

G-WAN v4.2.19 has been shipped with enhanced entity.c and entity_size.c examples which have been tested with a 1.7 MiB file upload. Just give it a try.

Gil
  • 3,279
  • 1
  • 15
  • 25
-1

it generate HDL_HTTP_ERRORS. so there is no way the servlet will be executed.

csw
  • 125
  • 6
  • The handler state HDL_HTTP_ERRORS gives you a chance to intercept HTTP errors (and provide another response), *it does not prevent scripts from being run*. – Gil Feb 08 '13 at 14:32
  • It will only reach HDL_HTTP_ERRORS when you enter text that is greater than 4KB. Other than that the script should work. Are you getting the same errors that I am getting? – Richard Heath Feb 08 '13 at 15:17
  • @RichardHeath yes, even not reach 4KB – csw Feb 08 '13 at 15:33
  • Thanks you for testing my script. Now I know it's not just my development environment. – Richard Heath Feb 08 '13 at 18:46
  • Nobody ever suggested that it was *your* environment. G-WAN v4.2.19 has been shipped with enhanced **entity.c** and **entity_size.c** examples which have been tested with a **1.7 MiB upload**. Just give it a try. – Gil Feb 19 '13 at 17:44