g wan - GWAN query string length issue -


i using gwan (v4.3.14) , facing strange issue. trying pass long text in query string. have figured out gwan not allow me pass query parameters beyond total request size of 537 characters.
it responds 400 bad request

an example string :

http://xxx.xxx.xxx.xxx:yyyy/?t.cpp&c=dbe9kdojgmm9yr7aypglqby1a9rzuiamdaantjsbobrjzo45yhbpao5venla6icmlsadzntucpkbkb0e0g15pfhcgb4onxqq3m1k0cx8k15rqkawb8mthuoihkp02vk9wwjfu5nkbjtwu80onudokwwpuigxkkcjiswjjncgdy1lqij1gnvgrggomthoxppsz1cl7zxif5cjwggzsbunaddtq5w4pbxvevnugobhryqdtylhi4tudeae2junswezxtqm1qkg3ezgkm2dn68r7yxpcefz2n1nxggukydgn6em7veq5g5lptvrdexn0fsozgbenfhxs2oljwghffcedgeu1dfknfxnac6ietbiivvtjv55wczi7wbita0r60kjkuzynn59w6xhnawtk0zcyn2rq8lraojhzjxhjcyl9sk6jw4d9k0wwlsizhdftolnpr9jyp2sesyhlujschpihor4fcbvwqmwh5yoddcpl2kbr6cjsjwabaac 

the code in c++ file is:

# include "gwan.h" # include <iostream> using namespace std;  int main (int argc, char * argv[]) {     if(argc)     {         cout<<argv[0];         xbuf_cat(get_reply(argv), argv[0]);     }     else     {         xbuf_cat(get_reply(argv), "pass me see on screen.");     }      return 200;  } 

can me make gwan accept query parameter of 1000 characters or more?

the error g-wan v4.5+ "414: request uri large".

many production http servers disable put/post entities avoid abuse.

g-wan first used limit larger 4kib, requests not need room have made possible developers decide.

the example below (see entity_size.c working example) shows how modify g-wan (server-global) put/post entity size limit servlet can done in init() or main() calls of connection handler, , gwan/init.c script available in v4.10+:

u32 *max_entity_size = (int*)get_env(argv, max_entity_size); *max_entity_size = 200 * 1024; // new size in bytes (200 kib) 

you can change limit @ time (even while given user connected) using ip filtering in connection handler.

your servlets decide entity anyway can dispose or store on disk or real-time processing, see entity.c example.

beyond this, there few things keep in mind:

  • to avoid dos attacks letting send huge entities server (in gbs), might enlarge request size of authorized users only;

  • when dealing requests without put/post entity may dynamically enlarge read buffer allocating more memoy read_xbuf using xbuf_growto().

now know how accept requests of length. make sure when needed.

you may want check other related values like:

  kalive_tmo       // time-out in ms http keep-alives   request_tmo      // time-out in ms waiting request   min_send_speed   // send rate in bytes/sec (if < close)   min_read_speed   // read rate in bytes/sec (if < close) 

all of them can setup gwan/init.c script - before request can hit server. can done g-wan handlers , servlets, shown in examples cited above.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -