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