Problem with program

void SetRain(void) {

  if (StrContains(HTTP_req, "Rainbow")) {
    while ((StrContains(HTTP_req, "Stop")) == false) {

      led.setColor(Rvalue, Gvalue, Bvalue);

      Rvalue = Rvalue + Rdirection;
      Gvalue = Gvalue + Gdirection;
      Bvalue = Bvalue + Bdirection;

      if (Rvalue >= 255 || Rvalue <= 0) {
        Rdirection = Rdirection * -1;
      }
      if (Gvalue >= 255 || Gvalue <= 0) {
        Gdirection = Rdirection * -1;
      }
      if (Bvalue >= 255 || Bvalue <= 0) {
        Bdirection = Bdirection * -1;
      }
      delay(500);
    }
  }
}

The function starts working when the word Rainbow appears in the variable HTTP_req after clicking the button on the page.
This function create a smooth change of RGB colors.
I would like this function to continue until I send the Stop value in HTTP_req
I don’t know how to do it because the program is constantly changing colors
It cannot see the Stop string because it is changing colors over and over.

Program snippets are rarely useful.

Why does Gdirection depend upon Rdirection?

Gdirection = Rdirection * -1;

delay (500) wastes the considerable power of the Arduino for 1/2 a second. Learning to use milis() would be better.

If HTTP_REQ never gets updated, the stop condition is never met.

What populates 'HTTP_req'? You probably fail to run the method that updates it.

aarg:
What populates ‘HTTP_req’? You probably fail to run the method that updates it.

Yes, I failed to start the method because the stop value is sent when the button on the website is clicked.

vaj4088:
Program snippets are rarely useful.

Why does Gdirection depend upon Rdirection?

Gdirection = Rdirection * -1;

delay (500) wastes the considerable power of the Arduino for 1/2 a second. Learning to use milis() would be better.

If HTTP_REQ never gets updated, the stop condition is never met.

Gdirection = Gdirection * -1;
sorry my bad