Re: IIS (or Isapi) adds 'Connection' header to response



Hi jimbob,

You should never set a connection header in your response from CGI or ISAPI.
IIS will set the connection header itself based on the client HTTP version,
whether the client wants keep-alive or not, and whether the response from
IIS can support keep-alive.

It's clear from your description below that the keep-alive is not happening
in your response, and adding your own connection header will not change
this.

To resolve the issue, you need to know why IIS is closing the connection.
Without knowing exactly what you are doing and how you are doing it, there
are more possible causes of this than I could list here. Off the top of my
head, here are the big ones (assuming that the client supports keep-alive):

1. You are sending a response from CGI. IIS 5.1 and earlier do not support
keep-alive responses from CGI. (Off the top of my head, I don't remember if
this is true or not for IIS 6. We made a number of improvements to CGI, but
I'd have to look at the code to remember if this was one of them.)

2. You are sending a response from a filter. No version of IIS can support
sending a response from a filter without closing the connection.

3. You are sending a response from an extension with
HSE_REQ_SEND_RESPONSE_HEADER and you have not included a content-length
header in the response.

These are the most common ways that responses are sent back. If you are
sending the response differently, then I'd have to know exactly what calls
you are making to tell you whether the connection will need to close or not.

The other thing I am curious about is why you need to write your own NTLM
implementation instead of using the one built into IIS.

Thank you,
-Wade A. Hilmo,
-Microsoft

PS: The microsoft.public.platformsdk.internet.server.isapi-dev is a better
place for this discussion.

"jimbob" <jsmyth1969@xxxxxxxxx> wrote in message
news:1135274452.830906.311270@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I am using IIS (5) as a gateway to a servlet container (I have a CGI &
> ISAPI version of a gateway for this communication).
>
> I am trying to implement NTLM authentication in the serlvet container
> but when my servlet returns a 401 header I always get a 'Connection:
> close' header added to the response by IIS. Even if I add my own
> Connection header to the response, I end up with 2 headers, so my
> Connection: keep-alive is ignored by the browser. In this case the
> browser will end the connection and resend the type 1 NTLM request
> again....
>
> I have verified (using ethereal) that the response headers are modified
> somewhere within IIS/ISAPI, but I dont know where - the only debug I
> have from the ISAPI plugin seems to suggest that the response is not
> modified there....
>
> I do not have any issues with a 200 response code (i.e. I do not get a
> Connection: close header)
>
> Is this likely to be IIS or is it more likely the way that the ISAPI
> plugin is writing to the client (browser). I understand from many
> posts that the CGI version of my gateway will not work as IIS will
> always force a Connection: close for CGIs....
>
> thanks for your input
>


.



Relevant Pages

  • [Full-Disclosure] [ANNOUNCE]: IISBanner 1.0
    ... We are proud to present a tool with the ability to change the IIS Response ... Customizing the response header ... "Server" is one of those tasks. ...
    (Full-Disclosure)
  • [Full-Disclosure] [ANNOUNCE]: IISBanner 1.0
    ... We are proud to present a tool with the ability to change the IIS Response ... Customizing the response header ... "Server" is one of those tasks. ...
    (Full-Disclosure)
  • RE: [Full-Disclosure] [ANNOUNCE]: IISBanner 1.0
    ... The ability to change the IIS server header is a ready available in the ... We are proud to present a tool with the ability to change the IIS Response ...
    (Full-Disclosure)
  • Re: xmlrpclib hangs execution
    ... A well-written client ... would detect the presence of a Content-Length header and use that. ... naturally, when the connection closes, the socket throws an error, ... # @return Response tuple and target method. ...
    (comp.lang.python)
  • IIS (or Isapi) adds Connection header to response
    ... ISAPI version of a gateway for this communication). ... close' header added to the response by IIS. ... Connection header to the response, I end up with 2 headers, so my ...
    (microsoft.public.inetserver.iis.security)