Skip to content

Instantly share code, notes, and snippets.

@zwetan
Created November 2, 2014 23:41
Show Gist options
  • Save zwetan/1bb76228478885845623 to your computer and use it in GitHub Desktop.
Save zwetan/1bb76228478885845623 to your computer and use it in GitHub Desktop.
debugging CGI
try
{
import C.stdio.*;
import flash.utils.ByteArray;
function write( message:String = "" ):void
{
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes( message );
bytes.position = 0;
fwrite( bytes, bytes.length, stdout );
fflush( stdout );
}
write( "Content-type: text/html\n\n" );
write( "Hello, World." );
}
catch( e:Error )
{
trace( "Content-type: text/html\n\n" );
trace( e.getStackTrace() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment