cancel
Showing results for 
Search instead for 
Did you mean: 

How to deal with connection.close() deprecation when replying using wire format?

Highlighted
Contributor

How to deal with connection.close() deprecation when replying using wire format?

 

Hello,

 

I am migrating from 9.9 to 10.2.

 

One of the changes is reported by this warning message about some of my rules:
"Use of connection.close is deprecated for HTTP virtual servers. Use http.sendResponse with http.disableClientKeepalive instead."

 

I understand the reasons behind this change.

But I use "Extra Files" to set a custom error page for a Virtual Server. Those error pages have to embed the HTTP status banner and the response headers. Then comes the body.

 

Because of this file format, it makes it pretty handy to use

connection.close(resource.get($extra_file));

To answer in HTTP the same way we would have in case of errors.

 

 

 

Now if I want to do the same with http.disableClientKeepalive() + http.sendResponse(), I will have to split HTTP banner, response headers, and body, which is a bit unoptimized even if I can store the result in memory (data.set()/data.get()).

 

What would you advise people to do rather than parse the file content or send a redundant extra file that would exclude headers?

 

Cheers,

 

Sameh