summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_go.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_go.c')
-rw-r--r--src/nxt_go.c95
1 files changed, 3 insertions, 92 deletions
diff --git a/src/nxt_go.c b/src/nxt_go.c
index b821cced..ee446921 100644
--- a/src/nxt_go.c
+++ b/src/nxt_go.c
@@ -10,30 +10,17 @@
static nxt_int_t nxt_go_init(nxt_task_t *task, nxt_common_app_conf_t *conf);
-static nxt_int_t nxt_go_prepare_msg(nxt_task_t *task,
- nxt_app_request_t *r, nxt_app_wmsg_t *msg);
-
static nxt_int_t nxt_go_run(nxt_task_t *task,
nxt_app_rmsg_t *rmsg, nxt_app_wmsg_t *msg);
nxt_application_module_t nxt_go_module = {
+ nxt_string("go"),
+ nxt_string("go"),
nxt_go_init,
- nxt_go_prepare_msg,
- nxt_go_run
+ nxt_go_run,
};
-nxt_int_t
-nxt_go_module_init(nxt_thread_t *thr, nxt_runtime_t *rt);
-
-nxt_int_t
-nxt_go_module_init(nxt_thread_t *thr, nxt_runtime_t *rt)
-{
- nxt_app_modules[NXT_APP_GO] = &nxt_go_module;
-
- return NXT_OK;
-}
-
extern char **environ;
nxt_inline int
@@ -113,82 +100,6 @@ nxt_go_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
static nxt_int_t
-nxt_go_prepare_msg(nxt_task_t *task, nxt_app_request_t *r, nxt_app_wmsg_t *wmsg)
-{
- nxt_int_t rc;
- nxt_buf_t *b;
- nxt_http_field_t *field;
- nxt_app_request_header_t *h;
-
- static const nxt_str_t eof = nxt_null_string;
-
- h = &r->header;
-
-#define RC(S) \
- do { \
- rc = (S); \
- if (nxt_slow_path(rc != NXT_OK)) { \
- goto fail; \
- } \
- } while(0)
-
-#define NXT_WRITE(N) \
- RC(nxt_app_msg_write_str(task, wmsg, N))
-
- /* TODO error handle, async mmap buffer assignment */
-
- NXT_WRITE(&h->method);
- NXT_WRITE(&h->target);
- if (h->path.start == h->target.start) {
- NXT_WRITE(&eof);
- } else {
- NXT_WRITE(&h->path);
- }
-
- if (h->query.start != NULL) {
- RC(nxt_app_msg_write_size(task, wmsg,
- h->query.start - h->target.start + 1));
- } else {
- RC(nxt_app_msg_write_size(task, wmsg, 0));
- }
-
- NXT_WRITE(&h->version);
-
- NXT_WRITE(&h->host);
- NXT_WRITE(&h->cookie);
- NXT_WRITE(&h->content_type);
- NXT_WRITE(&h->content_length);
-
- RC(nxt_app_msg_write_size(task, wmsg, h->parsed_content_length));
-
- nxt_list_each(field, h->fields) {
- NXT_WRITE(&field->name);
- NXT_WRITE(&field->value);
-
- } nxt_list_loop;
-
- /* end-of-headers mark */
- NXT_WRITE(&eof);
-
- RC(nxt_app_msg_write_size(task, wmsg, r->body.preread_size));
-
- for(b = r->body.buf; b != NULL; b = b->next) {
- RC(nxt_app_msg_write_raw(task, wmsg, b->mem.pos,
- nxt_buf_mem_used_size(&b->mem)));
- }
-
-#undef NXT_WRITE
-#undef RC
-
- return NXT_OK;
-
-fail:
-
- return NXT_ERROR;
-}
-
-
-static nxt_int_t
nxt_go_run(nxt_task_t *task,
nxt_app_rmsg_t *rmsg, nxt_app_wmsg_t *msg)
{