0

How can I return a 400 status code and close the connection, without aborting script execution? I'm looking to initiate execution of the script using <cfhttp> but not wait for the script to end before returning.

Yisroel
  • 8,164
  • 4
  • 26
  • 26

2 Answers2

8

You need to run the portion of the script you want to keep running after the connection is close, on a different thread.

Here's a tutorial on how to launch a new thread in Coldfusion.

Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
  • Long before there was a way to do this (I had some code that did this, but I cant remember.) is clearly the right way to go here. – Yisroel Apr 22 '12 at 00:57
0

If you want to hit a new request triggered from in another request without waiting just set the cfhttp timeout to 0 and it will return right away without waiting on response. For continuing a script after returning a separate thread may be a better idea but if you are hitting something outside the server or really need a separate request then cfhttp timeout=0 should do the trick.

Dan Roberts
  • 4,664
  • 3
  • 34
  • 43