How can the HTTP protocol version contained in the client request be determined?

  • Thread starter Thread starter Gery D. Dorazio
  • Start date Start date
G

Gery D. Dorazio

Hi,

I am trying to create my own custom logging mechanism using an IHttpModule.
To do this I gather various information about the request and response using
the HttpRequest and HttpResponse objects. This is fairly straight forward
except for determining the protocol version.

The W3C Extended Log Format defines the field 'cs-version' and says that it
is the protocol (HTTP, FTP) version used by the client and that if the
request is say HTTP then this will be either HTTP 1.0 or HTTP 1.1.

How can I determine this protocol version information when a request comes
in from the client?

Thanks,
Gery

--
Gery D. Dorazio
Development Engineer

EnQue Corporation
1334 Queens Road
Charlotte, NC 28207
(704) 377-3327
 
Gery D. Dorazio wrote:

I am trying to create my own custom logging mechanism using an IHttpModule.
To do this I gather various information about the request and response using
the HttpRequest and HttpResponse objects. This is fairly straight forward
except for determining the protocol version.

You can read out
Request.ServerVariables["SERVER_PROTOCOL"]
that yields for example
HTTP/1.1
 
Hi Martin,

I saw that server variable but I understood it to be the HTTP version that
the server is responding with and not the HTTP version that the client
request contained. Does the framework get the client HTTP version and
respond with the same HTTP version in this variable?

Thanks,
Gery

--
Gery D. Dorazio
Development Engineer

EnQue Corporation
1334 Queens Road
Charlotte, NC 28207
(704) 377-3327
Martin Honnen said:
Gery D. Dorazio wrote:

I am trying to create my own custom logging mechanism using an IHttpModule.
To do this I gather various information about the request and response using
the HttpRequest and HttpResponse objects. This is fairly straight forward
except for determining the protocol version.

You can read out
Request.ServerVariables["SERVER_PROTOCOL"]
that yields for example
HTTP/1.1
 
Gery D. Dorazio wrote:

I saw that server variable but I understood it to be the HTTP version that
the server is responding with and not the HTTP version that the client
request contained. Does the framework get the client HTTP version and
respond with the same HTTP version in this variable?

In my understanding of HTTP and with my tests here with a browser like
Mozilla where I am able to configure whether HTTP 1.0 or HTTP 1.1 is
used to make requests I think that the server uses the version of HTTP
the request is made in and therefore that variable can be said to show
both the request and response HTTP version.
 
Back
Top