aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2019-11-06 20:18:29 +0300
committerAleksey Veresov <aleksey@veresov.pro>2019-11-06 20:18:29 +0300
commitb11b1c52280f172ebfa42c3da906ea9aa3ea8799 (patch)
treec335acbc3cea17e1edb4fbc7b8f617019c68a2da /examples
parenta5ec437e91f90f25711c7e1b47b8238fdae6b103 (diff)
downloadmagi-b11b1c52280f172ebfa42c3da906ea9aa3ea8799.tar
magi-b11b1c52280f172ebfa42c3da906ea9aa3ea8799.tar.xz
magi-b11b1c52280f172ebfa42c3da906ea9aa3ea8799.zip
[magi] FastCGI is comming.
Diffstat (limited to 'examples')
-rw-r--r--examples/append.c5
-rw-r--r--examples/cookie.c5
-rw-r--r--examples/echo.c7
-rw-r--r--examples/upload.c3
4 files changed, 12 insertions, 8 deletions
diff --git a/examples/append.c b/examples/append.c
index 65caa33..b8aa1cf 100644
--- a/examples/append.c
+++ b/examples/append.c
@@ -1,12 +1,13 @@
+#include <cgi.h>
+#include <request.h>
#include <stdio.h>
#include <stdlib.h>
-#include <request.h>
void handle_request()
{
struct magi_request request;
- if (magi_request_build_cgi(&request, 0, 0)) {
+ if (magi_cgi(&request, 0, 0)) {
struct magi_field *a = magi_field_list_get(request.fields, "addon");
if (a && a->data) {
FILE *file = fopen("file_to_append", "a");
diff --git a/examples/cookie.c b/examples/cookie.c
index 8f4018b..dd18cc6 100644
--- a/examples/cookie.c
+++ b/examples/cookie.c
@@ -1,7 +1,8 @@
+#include <cgi.h>
#include <cookie.h>
+#include <request.h>
#include <stdio.h>
#include <stdlib.h>
-#include <request.h>
void print_preamble()
@@ -26,7 +27,7 @@ void print_webpage_top()
void read_and_print_cookies()
{
struct magi_request request;
- if (magi_request_build_cgi(&request, 0, 0)) {
+ if (magi_cgi(&request, 0, 0)) {
struct magi_cookie_list *cookie;
for (cookie = request.cookies; cookie; cookie = cookie->next) {
printf(
diff --git a/examples/echo.c b/examples/echo.c
index 33094a4..ff037a6 100644
--- a/examples/echo.c
+++ b/examples/echo.c
@@ -1,8 +1,9 @@
-#include <stdio.h>
-#include <stdlib.h>
+#include <cgi.h>
#include <cookie.h>
#include <param.h>
#include <request.h>
+#include <stdio.h>
+#include <stdlib.h>
void print_preamble()
@@ -76,7 +77,7 @@ void proceed_params(struct magi_param_list *params)
void handle_request()
{
struct magi_request request;
- if (magi_request_build_cgi(&request, 0, 0)) {
+ if (magi_cgi(&request, 0, 0)) {
puts("<h1>Echo CGI Script</h1>");
puts("I was called with method [");
puts(request.method);
diff --git a/examples/upload.c b/examples/upload.c
index 1dc9659..59dd020 100644
--- a/examples/upload.c
+++ b/examples/upload.c
@@ -3,6 +3,7 @@
#include <string.h>
#include <request.h>
#include <multipart.h>
+#include <cgi.h>
void tempfile_callback(struct magi_field *field, char *buffer, int len)
{
@@ -30,7 +31,7 @@ void tempfile_callback(struct magi_field *field, char *buffer, int len)
void handle_request()
{
struct magi_request request;
- if (magi_request_build_cgi(&request, tempfile_callback, 0)) {
+ if (magi_cgi(&request, tempfile_callback, 0)) {
struct magi_field *name = magi_field_list_get(request.fields, "name");
struct magi_field *data = magi_field_list_get(request.fields, "data");
if (name && name->data && data) {