Author: sevein
Date: Sat Oct 8 18:20:46 2011
New Revision: 9994
Log:
Get package content, compare MD5, etc...
Modified:
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
Modified:
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
==============================================================================
---
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
Sat Oct 8 17:05:30 2011 (r9993)
+++
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
Sat Oct 8 18:20:46 2011 (r9994)
@@ -63,7 +63,46 @@
return;
}
-
+ // Package content
+ $package_content = @file_get_contents('php://input');
+
+ // Package name
+ if (null !== $request->getHttpHeader('Content-Disposition'))
+ {
+ $package_name = substr($request->getHttpHeader('Content-Disposition'),
9);
+ }
+ else
+ {
+ // Server implementations MUST adopt the behaviour and requirements in
[RFC2183].
+ $package_name = 'foobar';
+ }
+
+ // 'Content-Type'
+ // 'Content-Length'
+
+ // Calculated MD5 check does not match the value provided by the client
+ if (true || md5($package_content) !=
$request->getHttpHeader('Content-MD5'))
+ {
+ $this->response->setStatusCode('412');
+
+ $this->response->setHttpHeader('Content-Type', 'application/atom+xml;
charset="utf-8"');
+
+ $request->setRequestFormat('xml');
+ $this->setTemplate('error/ErrorChecksumMismatchSuccess');
+
+ return;
+ }
+
+ // Create tmp dir, if it doesn't exist already
+ $tmpDir = sfConfig::get('sf_upload_dir').'/tmp';
+ if (!file_exists($tmpDir))
+ {
+ mkdir($tmpDir);
+ chmod($tmpDir, 0775);
+ }
+
+ // Check user authorization
+ // Check upload limit
// HTTP status code 201: Created
$this->response->setStatusCode('201');
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.