MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cgiInitialize

Function cgiInitialize

cgi-bin/var.c:321–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319 */
320
321int /* O - Non-zero if there was form data */
322cgiInitialize(void)
323{
324 const char *method, /* Form posting method */
325 *content_type, /* Content-Type of post data */
326 *cups_sid_cookie, /* SID cookie */
327 *cups_sid_form; /* SID form variable */
328
329
330 /*
331 * Setup a password callback for authentication...
332 */
333
334 cupsSetPasswordCB(cgi_passwd);
335
336 /*
337 * Set the locale so that times, etc. are formatted properly...
338 */
339
340 setlocale(LC_ALL, "");
341
342#ifdef DEBUG
343 /*
344 * Disable output buffering to find bugs...
345 */
346
347 setbuf(stdout, NULL);
348#endif /* DEBUG */
349
350 /*
351 * Get cookies...
352 */
353
354 cgi_initialize_cookies();
355
356 if ((cups_sid_cookie = cgiGetCookie(CUPS_SID)) == NULL)
357 {
358 fputs("DEBUG: " CUPS_SID " cookie not found, initializing!\n", stderr);
359 cups_sid_cookie = cgi_set_sid();
360 }
361
362 fprintf(stderr, "DEBUG: " CUPS_SID " cookie is \"%s\"\n", cups_sid_cookie);
363
364 /*
365 * Get the request method (GET or POST)...
366 */
367
368 method = getenv("REQUEST_METHOD");
369 content_type = getenv("CONTENT_TYPE");
370 if (!method)
371 return (0);
372
373 /*
374 * Grab form data from the corresponding location...
375 */
376
377 if (!_cups_strcasecmp(method, "GET"))
378 return (cgi_initialize_get());

Callers 6

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 10

cupsSetPasswordCBFunction · 0.85
cgi_initialize_cookiesFunction · 0.85
cgiGetCookieFunction · 0.85
cgi_set_sidFunction · 0.85
_cups_strcasecmpFunction · 0.85
cgi_initialize_getFunction · 0.85
cgi_initialize_multipartFunction · 0.85
cgi_initialize_postFunction · 0.85
cgiGetVariableFunction · 0.85
cgiClearVariablesFunction · 0.85

Tested by 1

mainFunction · 0.68