Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cachemodule fix for CGI mode, readme updated.

  • Loading branch information...
commit 306cf9c8be33bb918eee2c37eb3a3a5737807088 1 parent 4f87a73
@vixns vixns authored
View
5 Readme.md
@@ -8,6 +8,7 @@ For more documentation visit the [hxfcgi](http://haxe.org/com/libs/hxfcgi) wiki
Differences to haxe Web API:
----------------------------
-* If you using FastCGI you should use `Web.cacheModule()`, otherwise the module will be restarted after every request, which is quite slow.
-* If you using CGI if does not matter if you use `Web.cacheModule()`.
+* If you are using FastCGI you should use `Web.cacheModule()`, otherwise the module will be restarted after every request, which is quite slow.
+* If you are using CGI if does not matter if you use `Web.cacheModule()`.
+* When setting cache with `Web.cacheModule(run)`, `run` is called, don't call your `run` method after caching or it may run twice.
* You need to print some data, when sending headers only, call `Lib.print('');` after setting all headers.
View
3  src/hxfcgi.cpp
@@ -25,6 +25,7 @@
#include "basic.h"
#include "data.h"
+#include <fcgi_stdio.h>
DEFINE_KIND(hxRequest);
@@ -40,7 +41,6 @@ while( *cursor != 0 && *cursor != '\r' && *cursor != '\n' && *cursor != '\t' ) \
cursor++; \
}
-
inline hxfcgi::Request* get_request(value hreq) {
val_check_kind(hreq,hxRequest);
return (hxfcgi::Request*)val_data(hreq);
@@ -93,6 +93,7 @@ value hxfcgi_cache_module(value func) {
hxfcgi::Request *req;
while (true) {
try {
+ if(FCGX_IsCGI()) break;
req = new hxfcgi::Request();
val_call1(func,alloc_abstract(hxRequest,req));
delete req;
View
3  src/request.cpp
@@ -26,13 +26,12 @@
#include "data.h"
namespace hxfcgi {
-
+
Request::Request() {
header_sent = false;
post_fetched = false;
postData = "";
if (!FCGI_Accept()==0) {
- if(FCGX_IsCGI()) exit(1);
string error = "Could not generate Request";
throw error;
}
View
2  test/Example.hx
@@ -10,7 +10,7 @@ class Example {
static function main() {
Web.cacheModule(run);
- run();
+ //run();
}
static function run() {
View
2  test/Test.hx
@@ -11,7 +11,7 @@ class Test {
static function main() {
Web.cacheModule(run);
- run();
+ //run();
}
static function run() {
Please sign in to comment.
Something went wrong with that request. Please try again.