Copy link to clipboard
Copied
Hello,
I'm trying to use HTTP persistent connection (Connection: keepalive) with coldfusion dynamic content.
Actually, persistent connection already works fine with static content handle by IIS6.
Is there a way to enable it (using chunked encoding I think, or waiting the end of cfm execution to get the content length)
I'm looking for a solution on the "server configuration" side. I know I can deal manually with the content-length header on my cfm, but I'm looking for a larger solution.
Is anyone know a way to achieve it ?
For information, I'm using ColdFusion 8 Entreprise, IIS6 with Windows 2003 R2 32 bits.
Regards,
--
Erwan
Copy link to clipboard
Copied
What is your real goal? What is it about the default configuration that does not suffice for your needs? Just trying to understand what the motivation is, before showing how to dig into nuts and bolts, since it’s not something that’s asked about often, at all (in my experience).
/charlie
Copy link to clipboard
Copied
I'm just looking for a solution for having a persistent connection for the cfm file, and not only for static content like.
With my current configuration, the connection is closed after each call to cfm content...
Copy link to clipboard
Copied
I've gotta concede I knew nothing about this before starting to google about it just now, so I'm not going to be any help here. You're talking about this - http://en.wikipedia.org/wiki/HTTP_persistent_connection - right?
It looks to me like this is entirely down to the web server sending a keep-alive to the browser (HTTP 1.0), or it just happens as a matter of course (HTTP 1.1), and whether CF is involved in the mix is neither here nor there. Or should be neither here nor there. CF doesn't participate in the HTTP connection, so it oughtn't have any impact on matters.
Looking at my IIS config, one can either have keep alive switched on or off, and that's it. There's no suggestion that it's done for specific MIME types (not that a CFM-fulfilled request is intrinsically a different MIME type, but I could see how the different file extension could potentially confuse matters, if things weren't done in a sensible fashion), or any other configuration options at all.
Also, I can't see how - logically / sensibly - a keep-alive (working at TCP level) would be impacted by the kind of documents being sent over said connection. They're two completely different layers of the... ooh, I don't want to date myself by saying it, but... OSI model.
FWIW, all my CF requests have a "connection: keep-live" header sent, even though I'm using HTTP/1.0. This is on IIS 6, but using CF9.
What are you looking at that determines that the connection isn't being maintained? I'm not doubting what you said, but you've piqued my interest now, so want to have a look at it.
--
Adam
Copy link to clipboard
Copied
@Cameron: Yes, I'm talking about this.
The mechanism is handle by the web server, but, with dynamic content, since the web server does not know the size of the data that will be sent to the client, it has to use "Chunked" encoding, or the web server need to wait for the end of dynamic content before starting sending to the client.
Otherwise, the server always close connection, so that it don't have to deal with the size of the response.
When you say you CF request have "Connection: keep-alive", you are talking about the request sent by the client, or the server answer ?
Because, in my environnement, my browser send a "Connection: keep-alive", but the server always answer by a "Connection: close"... Here is what I want to change.
Copy link to clipboard
Copied
Gotcha. OK, more googling seems to have clarified the dynamic quandrary for me. I found this which seemed relevant: http://docstore.mik.ua/orelly/java-ent/servlet/ch05_03.htm
I dunno if this will work, but in your onRequestEnd() after you've finished composing the page, you can get a len() on the output buffer... len(getPageContext().getOut().getString()), and set your content length with that, then let CF flush everything as per usual.
As for which headers I was looking at, you're dead right I was looking at the request ones, not the response ones (duh). Oops. And I was seeing the same thing you were for the response headers. However if I specified the content-length, the "closed" went away.
I dunno if this is any help... like I said, I'm just googling stuff up and trying it. mayeb some of it is wheat rather than chaff 😉
--
Adam
PS: Why is it that depsite clearly signing everything I ever post as "Adam", people often tend to see my full name in the heading of the post and decide to call me "Cameron"? Not that it matters, but it intrigues me.
Copy link to clipboard
Copied
@Adam: (and not Cameron) Thanks for you suggestion, I can set content-length header, but I don't understand why there is no possibility to use chunked content while this is exactly what permit http persistent connection for dynamic content...
Copy link to clipboard
Copied
I don't know that you can't, but I am @ work (although one would be forgiven for thinking I was just sitting here all day), and was between meetings so posted my intermediary findings as soon as I found 'em. I hasten to add I don't actually "know" any of this stuff, I'm just googling it and experimenting as I go.
--
Adam