- /*
- * Grab the request line...
- */
-
- switch (sscanf(line, "%63s%1023s%63s", operation, con->uri, version))
- {
- case 1 :
- if (line[0])
- {
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "[Client %d] Bad request line \"%s\" from %s.",
- con->http.fd,
- _httpEncodeURI(buf, line, sizeof(buf)),
- con->http.hostname);
- cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
- cupsdCloseClient(con);
- }
- return;
- case 2 :
- con->http.version = HTTP_0_9;
- break;
- case 3 :
- if (sscanf(version, "HTTP/%d.%d", &major, &minor) != 2)
- {
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "[Client %d] Bad request line \"%s\" from %s.",
- con->http.fd,
- _httpEncodeURI(buf, line, sizeof(buf)),
- con->http.hostname);
- cupsdSendError(con, HTTP_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_1_1 && KeepAlive)
- con->http.keep_alive = HTTP_KEEPALIVE_ON;
- else
- con->http.keep_alive = HTTP_KEEPALIVE_OFF;
- }
- else
- {
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "[Client %d] Unsupported request line \"%s\" "
- "from %s.", con->http.fd,
- _httpEncodeURI(buf, line, sizeof(buf)),
- con->http.hostname);
- cupsdSendError(con, HTTP_NOT_SUPPORTED, CUPSD_AUTH_NONE);
- cupsdCloseClient(con);
- return;
- }
- break;
- }
-