]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
7e86f2f6 | 2 | * CGI test program for CUPS. |
ef416fc2 | 3 | * |
7e86f2f6 MS |
4 | * Copyright 2007-2014 by Apple Inc. |
5 | * Copyright 1997-2005 by Easy Software Products. | |
ef416fc2 | 6 | * |
e3101897 | 7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
ef416fc2 | 8 | */ |
9 | ||
10 | /* | |
11 | * Include necessary headers... | |
12 | */ | |
13 | ||
14 | #include "cgi.h" | |
15 | ||
16 | ||
17 | /* | |
18 | * 'main()' - Test the CGI code. | |
19 | */ | |
20 | ||
21 | int /* O - Exit status */ | |
7e86f2f6 | 22 | main(void) |
ef416fc2 | 23 | { |
24 | /* | |
25 | * Test file upload/multi-part submissions... | |
26 | */ | |
27 | ||
28 | freopen("multipart.dat", "rb", stdin); | |
29 | ||
30 | putenv("CONTENT_TYPE=multipart/form-data; " | |
31 | "boundary=---------------------------1977426492562745908748943111"); | |
32 | putenv("REQUEST_METHOD=POST"); | |
33 | ||
34 | printf("cgiInitialize: "); | |
35 | if (cgiInitialize()) | |
36 | { | |
37 | const cgi_file_t *file; /* Upload file */ | |
38 | ||
39 | if ((file = cgiGetFile()) != NULL) | |
40 | { | |
41 | puts("PASS"); | |
42 | printf(" tempfile=\"%s\"\n", file->tempfile); | |
43 | printf(" name=\"%s\"\n", file->name); | |
44 | printf(" filename=\"%s\"\n", file->filename); | |
45 | printf(" mimetype=\"%s\"\n", file->mimetype); | |
46 | } | |
47 | else | |
48 | puts("FAIL (no file!)"); | |
49 | } | |
50 | else | |
51 | puts("FAIL (init)"); | |
321d8d57 | 52 | |
ef416fc2 | 53 | /* |
54 | * Return with no errors... | |
55 | */ | |
56 | ||
57 | return (0); | |
58 | } |