- /*
- * Grab the request line...
- */
-
- switch (sscanf(line, "%63s%1023s%63s", operation, con->uri, version))
- {
- case 1 :
- if (line[0])
- {
- cupsdLogClient(con, CUPSD_LOG_ERROR,
- "Bad request line \"%s\" from %s.",
- _httpEncodeURI(buf, line, sizeof(buf)),
- httpGetHostname(con->http, NULL, 0));
- cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
- cupsdCloseClient(con);
- }
- return;
- case 2 :
- con->http->version = HTTP_VERSION_0_9;
- break;
- case 3 :
- if (sscanf(version, "HTTP/%d.%d", &major, &minor) != 2)
- {
- cupsdLogClient(con, CUPSD_LOG_ERROR,
- "Bad request line \"%s\" from %s.",
- _httpEncodeURI(buf, line, sizeof(buf)),
- httpGetHostname(con->http, NULL, 0));
- cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
- cupsdCloseClient(con);
- return;
- }
-
- if (major < 2)
- {
- con->http->version = (http_version_t)(major * 100 + minor);
- if (con->http->version == HTTP_VERSION_1_1 && KeepAlive)
- httpSetKeepAlive(con->http, HTTP_KEEPALIVE_ON);
- else
- httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
- }
- else
- {
- cupsdLogClient(con, CUPSD_LOG_ERROR,
- "Unsupported request line \"%s\" from %s.",
- _httpEncodeURI(buf, line, sizeof(buf)),
- httpGetHostname(con->http, NULL, 0));
- cupsdSendError(con, HTTP_STATUS_NOT_SUPPORTED, CUPSD_AUTH_NONE);
- cupsdCloseClient(con);
- return;
- }
- break;
- }
-