Question

I send small payloads of various sizes as "200" replies but once in a while the payload is empty (no HTML body) and G-WAN takes a long time to answer those requests.

Can you tell me what's happening and how to resolve this?

Thanks.

Was it helpful?

Solution

The reason why G-WAN took "a long time" to respond is because it expected a body from your PHP script.

As per the RFCs, 200 HTTP replies should not have an empty body.

You should rather use the 204 HTTP status code for when you must send an empty body.

In a PHP G-WAN script, this would be something like:

<?php
  exit(204); // return an HTTP code (204:'No Content')
?>

In a C G-WAN script, that will be:

int main(int argc, char *argv[])
{
   return 204;
}

As you see, reading the RFCs from time to time can help to remember that those guys have covered many useful cases.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top