Lines Matching defs:req

145     struct cgi_handle *req = (struct cgi_handle *)handle;
155 cprompt = req->promptstr - 1;
243 apr_file_printf(req->sout, "%s", buf[0]);
244 apr_file_gets(buf[0], MAX_BUFFER_SIZE, req->sin);
347 struct cgi_handle *req = (struct cgi_handle *)handle;
359 req->body_status = APREQ_ERROR_BADHEADER;
360 cgi_log_error(CGILOG_MARK, CGILOG_ERR, req->body_status, handle,
364 else if ((apr_uint64_t)content_length > req->read_limit) {
365 req->body_status = APREQ_ERROR_OVERLIMIT;
366 cgi_log_error(CGILOG_MARK, CGILOG_ERR, req->body_status, handle,
369 cl_header, req->read_limit);
374 if (req->parser == NULL) {
381 req->parser = apreq_parser_make(pool,
385 req->brigade_limit,
386 req->temp_dir,
387 req->hook_queue,
391 req->body_status = APREQ_ERROR_NOPARSER;
396 req->body_status = APREQ_ERROR_NOHEADER;
401 if (req->parser->brigade_limit > req->brigade_limit)
402 req->parser->brigade_limit = req->brigade_limit;
403 if (req->temp_dir != NULL)
404 req->parser->temp_dir = req->temp_dir;
405 if (req->hook_queue != NULL)
406 apreq_parser_add_hook(req->parser, req->hook_queue);
409 req->hook_queue = NULL;
410 req->in = apr_brigade_create(pool, ba);
411 req->tmpbb = apr_brigade_create(pool, ba);
416 APR_BRIGADE_INSERT_HEAD(req->in, pipe);
417 APR_BRIGADE_INSERT_TAIL(req->in, eos);
419 req->body_status = APR_INCOMPLETE;
426 struct cgi_handle *req = (struct cgi_handle *)handle;
430 if (req->body_status == APR_EINIT)
433 if (req->body_status != APR_INCOMPLETE)
434 return req->body_status;
437 switch (s = apr_brigade_partition(req->in, bytes, &e)) {
442 apreq_brigade_move(req->tmpbb, req->in, e);
443 req->bytes_read += bytes;
445 if (req->bytes_read > req->read_limit) {
446 req->body_status = APREQ_ERROR_OVERLIMIT;
447 cgi_log_error(CGILOG_MARK, CGILOG_ERR, req->body_status,
450 req->bytes_read, req->read_limit);
454 req->body_status =
455 apreq_parser_run(req->parser, req->body, req->tmpbb);
456 apr_brigade_cleanup(req->tmpbb);
462 apreq_brigade_move(req->tmpbb, req->in, e);
463 s = apr_brigade_length(req->tmpbb, 1, &len);
466 req->body_status = s;
469 req->bytes_read += len;
471 if (req->bytes_read > req->read_limit) {
472 req->body_status = APREQ_ERROR_OVERLIMIT;
473 cgi_log_error(CGILOG_MARK, CGILOG_ERR, req->body_status, handle,
476 req->bytes_read, req->read_limit);
481 req->body_status =
482 apreq_parser_run(req->parser, req->body, req->tmpbb);
483 apr_brigade_cleanup(req->tmpbb);
487 req->body_status = s;
490 return req->body_status;
498 struct cgi_handle *req = (struct cgi_handle *)handle;
500 if (req->interactive_mode && req->jar_status != APR_SUCCESS) {
505 apr_file_printf(req->sout, "[CGI] Requested all cookies\n");
507 apr_file_printf(req->sout, "[CGI] Please enter a name for cookie %d (or just hit ENTER to end): ",
509 apr_file_gets(buf, 65536, req->sin);
520 apreq_value_table_add(&p->v, req->jar);
522 req->jar_status = APR_SUCCESS;
525 if (req->jar_status == APR_EINIT) {
528 req->jar_status =
529 apreq_parse_cookie_header(handle->pool, req->jar, cookies);
532 req->jar_status = APREQ_ERROR_NODATA;
535 *t = req->jar;
536 return req->jar_status;
542 struct cgi_handle *req = (struct cgi_handle *)handle;
544 if (req->interactive_mode && req->args_status != APR_SUCCESS) {
549 apr_file_printf(req->sout, "[CGI] Requested all argument parameters\n");
551 apr_file_printf(req->sout, "[CGI] Please enter a name for parameter %d (or just hit ENTER to end): ",
553 apr_file_gets(buf, 65536, req->sin);
564 apreq_value_table_add(&p->v, req->args);
567 req->args_status = APR_SUCCESS;
570 if (req->args_status == APR_EINIT) {
573 req->args_status =
574 apreq_parse_query_string(handle->pool, req->args, qs);
577 req->args_status = APREQ_ERROR_NODATA;
580 *t = req->args;
581 return req->args_status;
590 struct cgi_handle *req = (struct cgi_handle *)handle;
594 if (req->jar_status == APR_EINIT && !req->interactive_mode)
597 t = req->jar;
601 if (!req->interactive_mode) {
610 apreq_value_table_add(&p->v, req->jar);
622 struct cgi_handle *req = (struct cgi_handle *)handle;
626 if (req->args_status == APR_EINIT && !req->interactive_mode)
629 t = req->args;
633 if (!req->interactive_mode) {
642 apreq_value_table_add(&p->v, req->args);
656 struct cgi_handle *req = (struct cgi_handle *)handle;
658 if (req->interactive_mode && req->body_status != APR_SUCCESS) {
662 apr_file_printf(req->sout, "[CGI] Requested all body parameters\n");
665 apr_file_printf(req->sout, "[CGI] Please enter a name for parameter %d (or just hit ENTER to end): ",
667 apr_file_gets(buf, 65536, req->sin);
678 apreq_value_table_add(&p->v, req->body);
681 req->body_status = APR_SUCCESS;
684 switch (req->body_status) {
688 if (req->body_status != APR_INCOMPLETE)
697 *t = req->body;
698 return req->body_status;
704 struct cgi_handle *req = (struct cgi_handle *)handle;
709 if (req->interactive_mode) {
710 val = apr_table_get(req->body, name);
720 apreq_value_table_add(&p->v, req->body);
727 switch (req->body_status) {
731 val = apr_table_get(req->body, name);
740 if (req->body_status != APR_INCOMPLETE)
747 val = apr_table_get(req->body, name);
756 if (req->find_param == NULL)
757 req->find_param = apreq_hook_make(handle->pool,
760 h = req->find_param;
761 h->next = req->parser->hook;
762 req->parser->hook = h;
766 hook_ctx->prev = req->parser->hook;
772 } while (req->body_status == APR_INCOMPLETE);
774 req->parser->hook = h->next;
780 if (req->body == NULL)
783 val = apr_table_get(req->body, name);
796 struct cgi_handle *req = (struct cgi_handle *)handle;
798 *parser = req->parser;
805 struct cgi_handle *req = (struct cgi_handle *)handle;
807 if (req->parser == NULL) {
809 if (req->hook_queue != NULL) {
810 apr_status_t s = apreq_parser_add_hook(parser, req->hook_queue);
814 if (req->temp_dir != NULL) {
815 parser->temp_dir = req->temp_dir;
817 if (req->brigade_limit < parser->brigade_limit) {
818 parser->brigade_limit = req->brigade_limit;
821 req->hook_queue = NULL;
822 req->parser = parser;
833 struct cgi_handle *req = (struct cgi_handle *)handle;
835 if (req->parser != NULL) {
836 return apreq_parser_add_hook(req->parser, hook);
838 else if (req->hook_queue != NULL) {
839 apreq_hook_t *h = req->hook_queue;
845 req->hook_queue = hook;
854 struct cgi_handle *req = (struct cgi_handle *)handle;
855 apr_size_t *limit = (req->parser == NULL)
856 ? &req->brigade_limit
857 : &req->parser->brigade_limit;
870 struct cgi_handle *req = (struct cgi_handle *)handle;
871 *bytes = (req->parser == NULL)
872 ? req->brigade_limit
873 : req->parser->brigade_limit;
881 struct cgi_handle *req = (struct cgi_handle *)handle;
883 if (req->read_limit > bytes && req->bytes_read < bytes) {
884 req->read_limit = bytes;
895 struct cgi_handle *req = (struct cgi_handle *)handle;
896 *bytes = req->read_limit;
904 struct cgi_handle *req = (struct cgi_handle *)handle;
905 const char **temp_dir = (req->parser == NULL)
906 ? &req->temp_dir
907 : &req->parser->temp_dir;
910 if (*temp_dir == NULL && req->bytes_read == 0) {
923 struct cgi_handle *req = (struct cgi_handle *)handle;
924 *path = (req->parser == NULL)
925 ? req->temp_dir
926 : req->parser->temp_dir;
972 struct cgi_handle *req;
980 req = apr_pcalloc(pool, sizeof *req);
985 req->handle.module = &cgi_module;
986 req->handle.pool = pool;
987 req->handle.bucket_alloc = ba;
988 req->read_limit = (apr_uint64_t) -1;
989 req->brigade_limit = APREQ_DEFAULT_BRIGADE_LIMIT;
991 req->args = apr_table_make(pool, APREQ_DEFAULT_NELTS);
992 req->body = apr_table_make(pool, APREQ_DEFAULT_NELTS);
993 req->jar = apr_table_make(pool, APREQ_DEFAULT_NELTS);
995 req->args_status =
996 req->jar_status =
997 req->body_status = APR_EINIT;
1000 req->interactive_mode = 1;
1001 apr_file_open_stdout(&(req->sout), pool);
1002 apr_file_open_stdin(&(req->sin), pool);
1003 req->promptstr=apr_pstrdup(pool, DEFAULT_PROMPT);
1006 apr_pool_userdata_setn(&req->handle, USER_DATA_KEY, NULL, pool);
1012 return &req->handle;