diff options
author | roberto@deban32 <roberto@deban32> | 2011-11-21 09:55:43 +0100 |
---|---|---|
committer | roberto@deban32 <roberto@deban32> | 2011-11-21 09:55:43 +0100 |
commit | 891f7707249e79129f48fd968ec7526427418270 (patch) | |
tree | b8839a8c0ddb2bdef00e2528cbd0340f5d143b15 | |
parent | 0b6d7159823d30b86e5f47e0b7b9a82aec35aa77 (diff) | |
download | uwsgi-891f7707249e79129f48fd968ec7526427418270.tar.gz |
added Lukas to CONTRIBUTORS
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | plugins/rack/rack_api.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4faccb1f..7670de1c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -14,3 +14,4 @@ Cal Leeming, Simplicity Media Ltd Luigi Scarso Corey Farwell Charles Duffy +Lukas Lalinsky diff --git a/plugins/rack/rack_api.c b/plugins/rack/rack_api.c index aefc4a7e..cfab385e 100644 --- a/plugins/rack/rack_api.c +++ b/plugins/rack/rack_api.c @@ -6,6 +6,26 @@ extern struct uwsgi_rack ur; #define uwsgi_rack_api(x, y, z) rb_define_module_function(rb_uwsgi_embedded, x, y, z) +VALUE rack_uwsgi_warning(VALUE *class, VALUE rbmessage) { + + Check_Type(rbmessage, T_STRING); + char *message = RSTRING_PTR(rbmessage); + size_t len = RSTRING_LEN(rbmessage); + + if (len > 80) { + uwsgi_log("- warning message must be max 80 chars, it will be truncated -"); + memcpy(uwsgi.shared->warning_message, message, 80); + uwsgi.shared->warning_message[80] = 0; + } + else { + memcpy(uwsgi.shared->warning_message, message, len); + uwsgi.shared->warning_message[len] = 0; + } + + return Qnil; +} + + VALUE rack_uwsgi_setprocname(VALUE *class, VALUE rbname) { Check_Type(rbname, T_STRING); @@ -690,6 +710,8 @@ void uwsgi_rack_init_api() { uwsgi_rack_api("mule_id", rack_uwsgi_mule_id, 0); uwsgi_rack_api("logsize", rack_uwsgi_logsize, 0); + uwsgi_rack_api("set_warning_message", rack_uwsgi_warning, 1); + if (uwsgi.cache_max_items > 0) { |