Commits

Aristarkh Zagorodnikov committed 918b601

Module now declines invalid requests and requests for missing files, thus allowing other modules to handle them

  • Participants
  • Parent commits f6e5dc5
  • Branches v0.3

Comments (0)

Files changed (1)

gridfs/mod_gridfs.cpp

 		return DECLINED;
    	request->allowed |= AP_METHOD_BIT << M_GET;
 	if (request->method_number != M_GET)
-		return HTTP_NOT_IMPLEMENTED;
+		return DECLINED;
 	if (*request->uri != '/' || request->uri[1] == '\0')
-		return HTTP_NOT_FOUND;
+		return DECLINED;
 	const char * filename = request->uri + 1;
 	if (config->context != 0)
 	{
 		ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, request, "mod_gridfs: Failed to allocate filename memory."); 
 		return HTTP_INTERNAL_SERVER_ERROR;
 	}
-	request->filename = const_cast<char *>(filename);
 	const std::string& database = *config->database;
 	apr_bucket_brigade *brigade = 0;
 	try
 								if (!gridfile.exists())
 								{
 									connection->done();
-									return HTTP_NOT_FOUND;
+									return DECLINED;
 								}
 							}
 							else
 							{
 								connection->done();
-								return HTTP_NOT_FOUND;
+								return DECLINED;
 							}
 						}
 						const mongo::Date_t upload_date = gridfile.getUploadDate();
 				apr_brigade_cleanup(brigade);
 			apr_sleep(RETRY_DELAY * 1000);
 		}
+		request->filename = const_cast<char *>(filename);
 		if (content_length != 0)
 			ap_set_content_length(request, content_length);
 		if (content_type.empty())