Is there a limit to IHttpRequest Reponse lengths?

I have an HTTP game server that I am setting up and I have one function that returns a lot of information about the map. The output from the server is about 7800 characters long, but when I get the contents of the URL in the game, the game only gets 1124 characters.

Is there a limit on the length of the response content of an IHttpRequest?

Pertinent code:


FString ANetwork::getContentsOfURL(FString URL, TArray<FString> keys, TArray<FString> values)
    {
    	serverResponse = NULL;

    	TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest();
     	HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json"));

    	int32 count = keys.Num();
    	URL += "?auth=" + authenticator;
	    for (int i = 0; i < count; i++)
	    {
	    	URL += "&" + keys* + "=" + values*;
	    }

	    HttpRequest->SetURL(URL);
	    HttpRequest->SetVerb(TEXT("GET"));
	    HttpRequest->OnProcessRequestComplete().BindUObject(this, &ANetwork::OnResponseReceived);
	    HttpRequest->ProcessRequest();

	    bool wait = true;
	    while (wait)
	    {
	    	FHttpResponsePtr response = HttpRequest->GetResponse();
	    	FHttpResponsePtr httpnull;
	    	if (response != httpnull)
	    	{
		    	if (HttpRequest->GetResponse()->GetContentAsString() != "")
		    	{
		    		return HttpRequest->GetResponse()->GetContentAsString();
		    	}
    		}
    	}

	    return "";
    }



bool wait = true;
        while (wait)
        {
            FHttpResponsePtr response = HttpRequest->GetResponse();
            FHttpResponsePtr httpnull;
            if (response != httpnull)
            {
                if (HttpRequest->GetResponse()->GetContentAsString() != "")
                {
                    return HttpRequest->GetResponse()->GetContentAsString();
                }
            }
        }


This part seems weird to me. Why don’t you put this logic in the delegate you’ve registered (OnResponseReceived)? This way you will make sure that when you call GetResponse() all data will be there (of course, if the request was successful in the first place).

I’m downloading entire images using IHttpRequest, so if there is a limit it’s not that small.

It’s probably because you’re blocking the main thread with a while() to wait for the HTTP response, likely preventing the engine from doing whatever it needs to do to receive the rest of the data. You need to use a delegate and deal with it asynchronously.