Fix handling of IPP POSTs - don't bother looking up resource path for them.
@@ -325,26 +325,8 @@ _papplClientProcessHTTP(
return (papplClientRespondHTTP(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0, 0));
case HTTP_STATE_POST :
- // See if we have a matching resource to serve...
- if ((resource = _papplSystemFindResource(client->system, client->uri)) != NULL)
- {
- if (resource->cb)
- {
- // Handle a post request through the callback...
- return ((resource->cb)(client, resource->cbdata));
- }
- else
+ if (!strcmp(httpGetField(client->http, HTTP_FIELD_CONTENT_TYPE), "application/ipp"))
{
- // Otherwise you can't POST to a resource...
- return (papplClientRespondHTTP(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0, 0));
- }
- }
- else if (strcmp(httpGetField(client->http, HTTP_FIELD_CONTENT_TYPE), "application/ipp"))
- {
- // Not an IPP request...
- return (papplClientRespondHTTP(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0, 0));
- }
-
// Read the IPP request...
client->request = ippNew();
@@ -360,6 +342,26 @@ _papplClientProcessHTTP(
// Now that we have the IPP request, process the request...
return (_papplClientProcessIPP(client));
+ }
+ else if ((resource = _papplSystemFindResource(client->system, client->uri)) != NULL)
+ {
+ // Serve a matching resource...
+ if (resource->cb)
+ {
+ // Handle a post request through the callback...
+ return ((resource->cb)(client, resource->cbdata));
+ }
+ else
+ {
+ // Otherwise you can't POST to a resource...
+ return (papplClientRespondHTTP(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0, 0));
+ }
+ }
+ else
+ {
+ // Not an IPP request or form, return an error...
+ return (papplClientRespondHTTP(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0, 0));
+ }
default :
break; // Anti-compiler-warning-code
