IIS7 replacing CGI input payload with single S character

Posted on 2012-08-13
Last Modified: 2014-02-08
I've got an IIS server which runs my standalone CGI EXE application (no ASP or similar)

When switching from IIS6 to IIS7 I frequently begin getting one single "S" character as input, from IIS7, to this exe program, instead of the actual payload from the end user browser.

This only happens when https is used, and it only happens "sometimes" (I cannot see any "system" in that, but some users are more "hit" than others)

Any ideas why the IIS7 payload *sometimes* is replaced with one  single "S" character, when presented to the CGI standsalone program, by the IIS7 server, driven by a user https request?

(question edited; removed eventviewer message that was probably not related)
Question by:stefanlennerbrant

    Author Comment

    This is really annoying! I cannot find anything on the internet, but I mean, IIS7 exchanging the request payload with an "S" character only, that seems so far-fletched that it probably  should be easily remembered by someone... :-)

    Are there any limitation settings in IIS7 that relates to https requests, setting max limits on concurrent requests etc etc?
    There are not that many requests on this server (like less than one per second, even though it of course may be more from time to time) and the requests (at least the ones that trigger the error) are small, no large data volumes.

    The failing requests use method POST and encoding application/x-www-form-urlencoded
    Note that some requests (often) works OK and some requests don't. Looks quite random.
    LVL 51

    Expert Comment

    can you post such a POST request?
    use LiveHTTPHeader add-on in firefox or something proper for IE

    Author Comment

    Further investigation indicates that the problem seems to be that the end user data is not available at the time when the CGI application is launched
    Thus, when the CGI program reads it (standard input) from IIS7, only one character is available, and is read.

    I am looking into if some config setting in IIS7 gives this behaviour, that "input buffering" is kind of disabled (just as response buffering may be disabled, for output), such that IIS7 is not able to present all input user data at the time the CGI program is starting.

    Also, I detected one (single) situation now where environment variable CONTENT_TYPE was empty (as set by IIS7) even though CONTENT_LENGTH was non-zero.
    I have never seen that before, and thus I wonder if this also may be due to the fact that the content-type setting has not been received/identified by IIS7 when the CGI program was launched.

    I'm continuing investigating. Does it even exist a "disable INPUT buffering to CGI" config setting in IIS7?

    Accepted Solution

    The problem was eventually solved by continuing reading (trying over and over again) in the CGI script.

    The root cause seems to be that IIS7 uses its setting "uploadReadAheadSize" to buffer input data to the script. When "enough" data has been read, about 40-50kb, the script is invoked.

    Thus, when the script tries to read end user input, it might not yet be available. Changing the script to looping (for at least some seconds) to really retrieve all data as specified in CONTENT_LENGTH, solves the problem.

    Increasing the IIS7 uploadReadAheadSize setting is another method, of course.

    Author Closing Comment

    Eventually solved

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Logparser is the smartest tool I have ever used in parsing IIS log files and there are many interesting things I wanted to share with everyone one of the  real-world  scenario from my current project. Let's get started with  scenario - How do w…
    Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
    This video discusses moving either the default database or any database to a new volume.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now