0

I ran gwan_1 (v3.3.28), and then visited the page http: //.../?persistence.c. It reponsed fast.

But when I changed "return 200;" to "return 9;" in the code, the browser responded slowly, about 4 seconds later.

In the document, it is stated that:

To prevent HTTP headers automatic completion, just make your servlets return an  invalid
HTTP status code in the 1-99 range (inclusive).
It works but very slowly.

Any idea about this? Is it a bug or I have done something wrong?
I have tried returning 1, 9, and 99. They all give the same results.

Gil
  • 3,279
  • 1
  • 15
  • 25
k.k. lou
  • 1,805
  • 2
  • 13
  • 16

2 Answers2

0

Finally, i got it.
This is NOT caused by gwan.
It is the browser behavior.
i used xbuf_frurl() to load the persistence.c, the response was about 0.35 ms. (cpu E2180)

k.k. lou
  • 1,805
  • 2
  • 13
  • 16
0

The Internet Browser is WAITING for the server reply. This is a client timeout.

Since in this particular case the server does not give the reply length in HTTP headers (because the 1-99 servlet return value means "inject no HTTP-headers if they are missing"), the client has to wait until it estimates that all should have been transmitted (at which point it displays the result).

You can send any reply without HTTP headers when you talk to an Internet Browser with JSON and AJAX (Javascript) because then the format is interpreted differently (JSON VS HTTP).

The G-WAN comet.c demo is using a plain-text message passing exchange with the browser because the Javascript code on the client side reads how long is the server reply (using a format made for this specific application).

Gil
  • 3,279
  • 1
  • 15
  • 25