Permalink
Browse files

added copyright/liciense

  • Loading branch information...
1 parent ca820c0 commit 6ac8f12a74facc095f8e1580c64c5a3bd94d7321 @alexly committed Apr 8, 2012
Showing with 129 additions and 11 deletions.
  1. +1 −1 config
  2. +16 −0 ngx_http_r4x_directive.c
  3. +25 −3 ngx_http_r4x_handler.c
  4. +16 −0 ngx_http_r4x_json_adapter.c
  5. +16 −0 ngx_http_r4x_module.c
  6. +23 −7 ngx_http_r4x_module.h
  7. +16 −0 ngx_http_r4x_redis_adapter.c
  8. +16 −0 ngx_http_r4x_utils.c
View
@@ -1,6 +1,6 @@
ngx_addon_name=ngx_http_r4x_module
HTTP_MODULES="$HTTP_MODULES ngx_http_r4x_module"
-NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_r4x_adapter.c
+NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_r4x_redis_adapter.c
$ngx_addon_dir/ngx_http_r4x_json_adapter.c
$ngx_addon_dir/ngx_http_r4x_module.c
$ngx_addon_dir/ngx_http_r4x_utils.c
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef DDEBUG
#define DDEBUG 0
#endif
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef DDEBUG
#define DDEBUG 0
#endif
@@ -32,6 +48,7 @@ static ngx_int_t
ngx_http_r4x_process_directive(ngx_http_request_t *r, ngx_http_r4x_directive_t *directive)
{
ngx_uint_t i;
+ ngx_int_t rc;
ngx_http_r4x_directive_arg_t *directive_arg;
directive_arg = directive->arguments_metadata.elts;
@@ -48,13 +65,18 @@ ngx_http_r4x_process_directive(ngx_http_request_t *r, ngx_http_r4x_directive_t *
if(directive->json_fields_hash != NULL && r->request_body != NULL) {
- if(ngx_http_r4x_proces_json_fields(r->request_body->buf->pos,
+ rc = ngx_http_r4x_proces_json_fields(r->request_body->buf->pos,
r->request_body->buf->last - r->request_body->buf->pos,
directive->json_fields_hash,
- directive->raw_redis_argvs, directive->raw_redis_argv_lens) != NGX_OK)
+ directive->raw_redis_argvs, directive->raw_redis_argv_lens);
+
+ if(rc == NGX_AGAIN)
{
- return NGX_ERROR;
+ // Process array
}
+ else if(rc != NGX_OK)
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+
}
}
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef DDEBUG
#define DDEBUG 0
#endif
View
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef DDEBUG
#define DDEBUG 0
#endif
View
@@ -1,5 +1,21 @@
-#ifndef __REDIS4NGINX_MODULE__
-#define __REDIS4NGINX_MODULE__
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _REDIS_4_NGINX_MODULE_INCLUDED_
+#define _REDIS_4_NGINX_MODULE_INCLUDED_
#define REDIS4NGINX_JSON_FIELD_ARG 0
#define REDIS4NGINX_COMPILIED_ARG 1
@@ -50,7 +66,7 @@ typedef struct {
unsigned wait_read_body:1;
} ngx_http_r4x_request_ctx;
-// Redis DB API
+// Redis DB API:
ngx_int_t
ngx_http_r4x_init_connection(ngx_http_r4x_srv_conf_t *serv_conf);
@@ -61,12 +77,12 @@ ngx_int_t
ngx_http_r4x_async_command_argv(redisCallbackFn *fn, void *privdata,
int argc, char **argv, const size_t *argvlen);
-// HTTP utilities
+// HTTP utilities:
void
ngx_http_r4x_send_redis_reply(ngx_http_request_t *r, redisAsyncContext *c,
redisReply *reply);
-// Directive utilities
+// Directive utilities:
ngx_int_t
ngx_http_r4x_get_directive_argument_value(ngx_http_request_t *r,
ngx_http_r4x_directive_arg_t *arg, char **value, size_t *len);
@@ -75,12 +91,12 @@ char *
ngx_http_r4x_compile_directive(ngx_conf_t *cf, ngx_http_r4x_loc_conf_t * loc_conf,
ngx_http_r4x_srv_conf_t *srv_conf, ngx_http_r4x_directive_t *directive);
-// Json
+// Json utilities:
ngx_int_t
ngx_http_r4x_proces_json_fields(u_char* jsonText, size_t jsonTextLen,
ngx_hash_t *json_fields_hash, char **argvs, size_t *lens);
-// String utilities
+// String utilities:
void
ngx_http_r4x_hash_script(ngx_str_t *digest, ngx_str_t *script);
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef DDEBUG
#define DDEBUG 0
#endif
View
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2011-2012, Alexander Lyalin <alexandr.lyalin@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef DDEBUG
#define DDEBUG 0
#endif

0 comments on commit 6ac8f12

Please sign in to comment.