Lines Matching refs:fs

47 static nxt_buf_t *nxt_fastcgi_request_create(nxt_fastcgi_source_t *fs);
48 static nxt_int_t nxt_fastcgi_next_param(nxt_fastcgi_source_t *fs,
58 nxt_fastcgi_source_t *fs, nxt_buf_t *b);
61 nxt_fastcgi_source_t *fs);
67 static void nxt_fastcgi_source_header_ready(nxt_fastcgi_source_t *fs,
74 static void nxt_fastcgi_source_fail(nxt_task_t *task, nxt_fastcgi_source_t *fs);
125 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_handler() local
127 fs = nxt_mp_zget(us->buffers.mem_pool, sizeof(nxt_fastcgi_source_t)); in nxt_fastcgi_source_handler()
128 if (nxt_slow_path(fs == NULL)) { in nxt_fastcgi_source_handler()
132 us->protocol_source = fs; in nxt_fastcgi_source_handler()
134 fs->header_in.list = nxt_list_create(us->buffers.mem_pool, 8, in nxt_fastcgi_source_handler()
136 if (nxt_slow_path(fs->header_in.list == NULL)) { in nxt_fastcgi_source_handler()
140 fs->header_in.hash = us->header_hash; in nxt_fastcgi_source_handler()
141 fs->upstream = us; in nxt_fastcgi_source_handler()
142 fs->request_create = request_create; in nxt_fastcgi_source_handler()
163 stream->next = &fs->query; in nxt_fastcgi_source_handler()
166 fs->record.next.context = fs; in nxt_fastcgi_source_handler()
167 fs->record.next.filter = nxt_fastcgi_source_header_filter; in nxt_fastcgi_source_handler()
169 fs->record.parse.last_buf = nxt_fastcgi_source_last_buf; in nxt_fastcgi_source_handler()
170 fs->record.parse.data = fs; in nxt_fastcgi_source_handler()
171 fs->record.parse.mem_pool = us->buffers.mem_pool; in nxt_fastcgi_source_handler()
173 fs->query.context = &fs->record.parse; in nxt_fastcgi_source_handler()
174 fs->query.filter = nxt_fastcgi_source_record_filter; in nxt_fastcgi_source_handler()
176 fs->header_in.content_length = -1; in nxt_fastcgi_source_handler()
178 stream->out = nxt_fastcgi_request_create(fs); in nxt_fastcgi_source_handler()
181 nxt_memzero(&fs->u.header, sizeof(nxt_http_split_header_parse_t)); in nxt_fastcgi_source_handler()
182 fs->u.header.mem_pool = fs->upstream->buffers.mem_pool; in nxt_fastcgi_source_handler()
190 nxt_fastcgi_source_fail(task, fs); in nxt_fastcgi_source_handler()
195 nxt_fastcgi_request_create(nxt_fastcgi_source_t *fs) in nxt_fastcgi_request_create() argument
212 ret = nxt_buf_pool_mem_alloc(&fs->upstream->buffers, 0); in nxt_fastcgi_request_create()
217 b = fs->upstream->buffers.current; in nxt_fastcgi_request_create()
218 fs->upstream->buffers.current = NULL; in nxt_fastcgi_request_create()
245 ret = nxt_fastcgi_next_param(fs, &param); in nxt_fastcgi_request_create()
310 b = nxt_buf_mem_alloc(fs->upstream->buffers.mem_pool, 16, 0); in nxt_fastcgi_request_create()
332 nxt_fastcgi_next_param(nxt_fastcgi_source_t *fs, nxt_fastcgi_param_t *param) in nxt_fastcgi_next_param() argument
343 switch (fs->state) { in nxt_fastcgi_next_param()
346 ret = fs->request_create(fs); in nxt_fastcgi_next_param()
353 &fs->u.request.name, &fs->u.request.value); in nxt_fastcgi_next_param()
355 fs->state = sw_value_length; in nxt_fastcgi_next_param()
358 fs->u.request.name.len); in nxt_fastcgi_next_param()
362 fs->state = sw_name; in nxt_fastcgi_next_param()
365 fs->u.request.value.len); in nxt_fastcgi_next_param()
369 fs->state = sw_value; in nxt_fastcgi_next_param()
370 param->buf = fs->u.request.name.data; in nxt_fastcgi_next_param()
371 param->len = fs->u.request.name.len; in nxt_fastcgi_next_param()
375 fs->state = sw_name_length; in nxt_fastcgi_next_param()
376 param->buf = fs->u.request.value.data; in nxt_fastcgi_next_param()
377 param->len = fs->u.request.value.len; in nxt_fastcgi_next_param()
391 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_record_filter() local
405 fs = nxt_container_of(fsr, nxt_fastcgi_source_t, record); in nxt_fastcgi_source_record_filter()
408 nxt_fastcgi_source_fail(task, fs); in nxt_fastcgi_source_record_filter()
418 task, fs, NULL); in nxt_fastcgi_source_record_filter()
445 nxt_source_filter(task->thread, fs->upstream->work_queue, task, in nxt_fastcgi_source_record_filter()
454 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_record_error() local
456 fs = obj; in nxt_fastcgi_source_record_error()
458 nxt_fastcgi_source_fail(task, fs); in nxt_fastcgi_source_record_error()
467 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_header_filter() local
469 fs = obj; in nxt_fastcgi_source_header_filter()
476 nxt_fastcgi_source_sync_buffer(task, fs, b); in nxt_fastcgi_source_header_filter()
481 ret = nxt_http_split_header_parse(&fs->u.header, &b->mem); in nxt_fastcgi_source_header_filter()
487 ret = nxt_fastcgi_source_header_process(task, fs); in nxt_fastcgi_source_header_filter()
496 nxt_fastcgi_source_header_ready(fs, b); in nxt_fastcgi_source_header_filter()
506 fs->u.header.parse.header_end in nxt_fastcgi_source_header_filter()
507 - fs->u.header.parse.header_name_start, in nxt_fastcgi_source_header_filter()
508 fs->u.header.parse.header_name_start); in nxt_fastcgi_source_header_filter()
513 nxt_fastcgi_source_fail(task, fs); in nxt_fastcgi_source_header_filter()
524 nxt_fastcgi_source_sync_buffer(nxt_task_t *task, nxt_fastcgi_source_t *fs, in nxt_fastcgi_source_sync_buffer() argument
533 fs->upstream->buffers.max, fs->upstream->buffers.size); in nxt_fastcgi_source_sync_buffer()
538 nxt_fastcgi_source_fail(task, fs); in nxt_fastcgi_source_sync_buffer()
543 nxt_fastcgi_source_header_process(nxt_task_t *task, nxt_fastcgi_source_t *fs) in nxt_fastcgi_source_header_process() argument
551 hp = &fs->u.header.parse; in nxt_fastcgi_source_header_process()
562 nv = nxt_list_add(fs->header_in.list); in nxt_fastcgi_source_header_process()
582 if (nxt_lvlhsh_find(&fs->header_in.hash, &lhq) == NXT_OK) { in nxt_fastcgi_source_header_process()
585 if (unv->handler(fs->upstream, nv) == NXT_OK) { in nxt_fastcgi_source_header_process()
618 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_status() local
626 fs = us->protocol_source; in nxt_fastcgi_source_status()
627 fs->header_in.status = n; in nxt_fastcgi_source_status()
640 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_content_length() local
645 fs = us->protocol_source; in nxt_fastcgi_source_content_length()
646 fs->header_in.content_length = length; in nxt_fastcgi_source_content_length()
655 nxt_fastcgi_source_header_ready(nxt_fastcgi_source_t *fs, nxt_buf_t *b) in nxt_fastcgi_source_header_ready() argument
661 fs->record.next.filter = nxt_fastcgi_source_body_filter; in nxt_fastcgi_source_header_ready()
664 fs->rest = b; in nxt_fastcgi_source_header_ready()
667 if (fs->header_in.status == 0) { in nxt_fastcgi_source_header_ready()
669 fs->header_in.status = 200; in nxt_fastcgi_source_header_ready()
672 fs->upstream->state->ready_handler(fs); in nxt_fastcgi_source_header_ready()
685 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_body_filter() local
687 fs = obj; in nxt_fastcgi_source_body_filter()
695 b->data = fs->upstream->data; in nxt_fastcgi_source_body_filter()
696 b->completion_handler = fs->upstream->state->completion_handler; in nxt_fastcgi_source_body_filter()
700 if (fs->next != NULL) { in nxt_fastcgi_source_body_filter()
701 nxt_source_filter(task->thread, fs->upstream->work_queue, task, in nxt_fastcgi_source_body_filter()
702 fs->next, in); in nxt_fastcgi_source_body_filter()
706 nxt_buf_chain_add(&fs->rest, in); in nxt_fastcgi_source_body_filter()
714 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_last_buf() local
716 fs = fp->data; in nxt_fastcgi_source_last_buf()
721 b->data = fs->upstream->data; in nxt_fastcgi_source_last_buf()
722 b->completion_handler = fs->upstream->state->completion_handler; in nxt_fastcgi_source_last_buf()
732 nxt_fastcgi_source_t *fs; in nxt_fastcgi_source_error() local
736 fs = stream->upstream->protocol_source; in nxt_fastcgi_source_error()
738 nxt_fastcgi_source_fail(task, fs); in nxt_fastcgi_source_error()
743 nxt_fastcgi_source_fail(nxt_task_t *task, nxt_fastcgi_source_t *fs) in nxt_fastcgi_source_fail() argument
749 fs->upstream->state->error_handler(task, fs, NULL); in nxt_fastcgi_source_fail()