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

  • Thread starter Gery D. Dorazio
  • 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
 
M

Martin Honnen

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
 
G

Gery D. Dorazio

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
 
M

Martin Honnen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top