1

Closed

MaxFieldLength should be settable in IIRF

description

from http://iirf.codeplex.com/discussions/274469
 
A large request header can cause failures in IIRF when proxying requests.
 
There's a hard-coded limit in IIRF on the size of a request header - 4k for each header. When the header on a request to be proxied is larger than 4k, IIRF passes a dummy string that is not a valid header. Which gives a ERROR_INVALID_PARAMETER (errno 87) error in WinHttpAddRequestHeaders.
 
There are really two problems in IIRF:
 
  1. When the request exceeds the size of IIRF's hardcoded limit, IIRF just silently passes through that error, and instead of formatting the large header correctly, it formats a dummy string. IIRF should fail fast and emit a clear error message into the log.
     
  2. There's no way to modify the hardcoded limit in IIRF.
     
    This workitem should fix both issues.
     
    This will introduce a new directive for use within IIRF.ini files: MaxFieldLength . This name is borrowed from the IIS Registry entry described in http://support.microsoft.com/kb/820129 . Optimally, IIRF would read the registry and set the value intelligently. But I think I may defer that particular capability until it is specifically requested.

file attachments

Closed Oct 6, 2011 at 7:41 PM by Cheeso
This is fixed in changeset 93297. The first binary with this change: v2.1.2.0

comments

Cheeso wrote Oct 2, 2011 at 9:44 PM

ok, here is a patched binary. Try this out, it should just "work". I've raised the default limit to 16k from 4k, so your case should just work.

Cheeso wrote Oct 2, 2011 at 9:49 PM

here is the x64 version of the patched IIRF. There's a new MaxFieldLength directive supported in these binaries. It works in IirfGlobal.ini. But, as I said, you don't need to use it, because I modified the default max header size to reflect the IIS default, which is 16k. So you should just be able to drop these DLLs into your install directory and re-run, and it should work.

Just to review : this is an interim build of IIRF. You should not use this in production. Here's how you can test this thing:
  1. stop iis (net stop w3svc, or do it from the IIS MMC tool)
  2. open a cmd.exe prompt or explorer window, and go to the location where you've installed IIRF.
  3. Rename the IIRF.dll to IIRF.orig.dll.
  4. download the appropriate zip attached here, wither x86 or x64 depending on your requirements.
  5. Unpack the IIRF.dll from the archive, and put it in place of the original installation directory.
  6. restart IIS (net start w3svc, or via IIS Mgmt console)
  7. re-run your scenario.
  8. Report your results!! If this fixes your problem I will produce a proper release.