3

Today, G-WAN proceed requests like this (sample using the loan.java servlet):

localhost/?loan.java&name=Eva&amount=100000&term=5&rate=4.2

Could a specific handler (or even better a G-WAN switch) proceed requests like that:

localhost/loan.java?name=Eva&amount=100000&term=5&rate=4.2

where:

a) there is no "?" character right before the name of the servlet name but just before the first parameter and,

b) the "&" character is placed not before the first parameter but before the second, then the third, the fourth, (and so on) parameters.

Such a handler (or even better a G-WAN switch) will make G-WAN compatible with the zillions of codes (Go, Java, Mono, NodeJS, PHP, Ruby, etc.) used to create web applications and web sites that today devs are obliged to rewrite to simply be usable with G-WAN and benefit of its hight performances, scalability and security.

Note: previous answers never ever answered to the question of another contibutor: "how to remove the "?" character" and the init.c code doesn't provide the way to remove the QUERY_CHAR but:

a) only to chose from the character set: - _ . ! ~ * ' ( ) and,

b) not to place the "?" and the "&" charaters at the right spots as needed above.

So, I hope my question is more clear.

And if money is needed, what would be the price to pay to the G-WAN devs to get such a handler (or even better a G-WAN switch) with the standard G-WAN release to proceed requests like all the other web servers do, even if using a regex piece of code would slow down G-WAN a little bit (if any)?

Thank you in advance for a way to achieve such a needed enhancement to this exceptionnal web application server.

PCKB
  • 107
  • 1
  • 8
  • 1
    I'm voting to close this question as off-topic because this seems to be a request to enhance/modify a 3rd party product. – Jim Garrison Mar 15 '16 at 22:47
  • @Jim: this is a request about how to programmatically modify the default G-WAN behavior. Quite relevant in stackoverflow. – Gil Mar 16 '16 at 14:05

1 Answers1

1

There's such an example of Connection Handler on the G-WAN website. You just can rewrite request as you wish before/while/after G-WAN processes them.

In the website example, replace line #6 by:

char *p = strstr(read_xbuf->ptr, ".java?"); 
if(p) 
{ 
   char *b = p; while(*b != '/') b--; // find script name
   memmove(b + 1, b, p + sizeof(".java?") - (b + 2)); // make room
   b[1] = '?'; // add leading '?'
}

This will do the reqrite you wanted. Drop us a line at gwan.ch if you have a problem with that code.

Please mark as "accepted" the answers that match your needs.

Gil
  • 3,279
  • 1
  • 15
  • 25
  • Thank you Gil for your fast answer and I took a look at your sample. Unfortunately, I don't have the skill to modifiy your sample to do what is requested by the young pupils of my non profit organization (computer school of Mirmande). So, what amout of money do the G-WAN folks need to provide such a handler that would become free for all the other users as a part of the next G-WAN release? TIA for a financial quote. – PCKB Mar 16 '16 at 17:33