Note that there are some explanatory texts on larger screens.

plurals
  1. POIndy IdHTTPServer GET response parameters randomly missing
    text
    copied!<p>I'm writing a Delphi-based Windows server for a tablet-based HTML client.</p> <p>Most files are served out unprocessed, as you would expect of a web server, but a handful of special keywords are being interpreted as special commands that interface with other software on the server.</p> <p>Most of the time, everything is fine. But then, seemingly at random, I'd get an access violation, and it would be while trying to retrieve one of the GET parameters.</p> <p>This was driving me mad, so I encapsulated the entire thing down into a function and just started testing for the existence of the <em>TIdHTTPRequestInfo</em> data (shown here as the public property <em>Request</em> inside the class):</p> <pre><code>function TELSCommand.GETValue(key:AnsiString):AnsiString; begin if not Assigned(Request) then begin Log.e('WHERE IS REQUEST?'); Result := ''; Exit; end; if not Assigned(Request.Params) then begin Log.e('WHERE IS REQUEST PARAMS?'); Result := ''; Exit; end; if (Request.Params.IndexOfName(key) &gt;= 0) then Result := Request.Params.Values[key] else Result := ''; end; </code></pre> <p>I didn't actually expect either of the two Assigned() checks to get triggered, but, randomly, the second one will get tripped, and I'll see "WHERE IS REQUEST PARAMS?" in my log file after hitting F5 (slowly, I'm not hammering the server).</p> <p>When I throw down a breakpoint inside the block and inspect the value of Request when it hits that point, the entire <em>TIdHTTPRequestInfo</em> structure is filled with default, empty data. If I check the browser to see what request it sent, it's what I would expect... (generally just a request for "<em>/details?id=222</em>", for example).</p> <p>I should note that I'm developing on Windows 7 64-bit, so I'm constantly paranoid of things like this being caused by it. More than once I've hit snags that turned out to be because of 64-bit wackiness.</p> <p>Additional info: Indy 9, Delphi 2007.</p> <p>Hopefully this was clear enough to understand. I'm not looking for specific answers, since I haven't provided nearly enough; I'm just looking for suggestions on where to go from here. Much appreciated! :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload