URL Address - page 2

 
Fernando Carreiro #:
The function "WebRequest" is an internal function and reserved. Don't try to redefine it, much less create an infinite recursion.

Or an infinite request with an error code = 0

 
Thomas Bradley Butler #: I did that originally, but it did not make any request.  

What do you mean "I did that originally"?

Show your proper original code (all relevant parts of it)!

Thomas Bradley Butler #: it will continue to request and then throw an error stack overflow

If it throws a "stock overflow error" then you probably have an "infinite recursion". Do you understand what that means?

It means that the function is calling itself over and over.

 
Fernando Carreiro #:
"infinite recursion

Yes just don't know how to stop it

 
Fernando Carreiro #:

What do you mean "I did that originally"?

Show your proper original code (all relevant parts of it)!

If it throws a "stock overflow error" then you probably have an "infinite recursion". Do you understand what that means?

It means that the function is calling itself over and over.

Infinite loop, only happen when I changed the request function.  But not changing it, keeping with the example, it did nothing

 
Thomas Bradley Butler #: Infinite loop, only happen when I changed the request function.  But not changing it, keeping with the example, it did nothing

You still have not show your proper code, so there is not much more that can be said.

 
Fernando Carreiro #:

You still have not show your proper code, so there is not much more that can be said.

I did show the code

 
Thomas Bradley Butler #: I did show the code

That was the code that redefines an internal reserved function with infinite recursion. It is "bad" code that needs to be fixed.

So, show the new fixed code that properly addresses the issues pointed out.

  1. Don't create infinite recursion.
  2. Don't redefine the internal function.

You also stated that your original code did not do that, so why have you not shown that original code instead?

If you want help with the code, then you need to be more forthcoming. We cannot read your mind nor see your computer.

 
Thomas Bradley Butler #:

I did show the code

This is the part that is causing it

// Function to perform HTTP request
int WebRequest(
    const string method,
    const string url,
    const string headers,
    int timeout,
    const char data[],
    string &result
)
{
    int startTime = GetTickCount();

    while (timeout > 0)
    {
        Print("Making request to URL:", url);

        int request = WebRequest(method, url, headers, 0, data, result);  // Set timeout to 0 for one-time call

        if (request != -1)
        {
            // Print the response data for debugging
            Print("Response data:", result);

            return request;
        }

        Print("Error in MyWebRequest. Error code =", GetLastError());

        int elapsed = GetTickCount() - startTime;
        if (elapsed < 1000)
        {
            Sleep(1000 - elapsed);
        }

        timeout--;
        startTime = GetTickCount();
    }

    Print("WebRequest timeout reached. Aborting request for URL:", url);
    return -1; // or handle the timeout error accordingly
}




// Internal function for HTTP request
int WebRequestInternal(
    const string method,
    const string url,
    const string headers,
    const char data[],
    string &result
)
{
    int request = WebRequest(method, url, headers, 0, data, result);  // Set timeout to 0 for one-time call
    return request;
}


 
Fernando Carreiro #:

That was the code that redefines an internal reserved function with infinite recursion. It is "bad" code that needs to be fixed.

So, show the new fixed code that properly addresses the issues pointed out.

  1. Don't create infinite recursion.
  2. Don't redefine the internal function.

You also stated that your original code did not do that, so why have you not shown that original code instead?

If you want help with the code, then you need to be more forthcoming. We cannot read your mind nor see your computer.


You mean the entire code?  it is the Web Request function that is the issue and I have no idea which is why I am here

 
Fernando Carreiro #:

That was the code that redefines an internal reserved function with infinite recursion. It is "bad" code that needs to be fixed.

So, show the new fixed code that properly addresses the issues pointed out.

  1. Don't create infinite recursion.
  2. Don't redefine the internal function.

You also stated that your original code did not do that, so why have you not shown that original code instead?

If you want help with the code, then you need to be more forthcoming. We cannot read your mind nor see your computer.

No, the original function here for wen request that you said use.  That was the original and it did not do anything, did not serve any purpose