Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djrandom-py
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
djrandom-py
Commits
dddb5d13
"git@git.autistici.org:ai3/accountserver.git" did not exist on "2701bb2be45520c834789405e95151d36425eb65"
Commit
dddb5d13
authored
13 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
use a POST request for uploads to work around a gevent issue
parent
b9a36274
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/djrandom_client/upload.py
+1
-1
1 addition, 1 deletion
client/djrandom_client/upload.py
server/djrandom/receiver/receiver.py
+5
-2
5 additions, 2 deletions
server/djrandom/receiver/receiver.py
with
6 additions
and
3 deletions
client/djrandom_client/upload.py
+
1
−
1
View file @
dddb5d13
...
...
@@ -56,7 +56,7 @@ class Uploader(object):
headers
=
{
'
X-Key
'
:
self
.
api_key
,
'
Content-Type
'
:
'
audio/mpeg
'
,
'
Content-Length
'
:
str
(
filesize
)})
req
.
get_method
=
lambda
:
'
P
U
T
'
req
.
get_method
=
lambda
:
'
P
OS
T
'
result
=
json
.
loads
(
urllib2
.
urlopen
(
req
).
read
())
return
result
[
'
status
'
]
finally
:
...
...
This diff is collapsed.
Click to expand it.
server/djrandom/receiver/receiver.py
+
5
−
2
View file @
dddb5d13
...
...
@@ -44,7 +44,7 @@ def _upload_mp3(incoming_fd, sha1):
log
.
info
(
'
successfully stored %s
'
%
(
sha1
,))
@app.route
(
'
/upload/<sha1>
'
,
methods
=
[
'
P
U
T
'
])
@app.route
(
'
/upload/<sha1>
'
,
methods
=
[
'
P
OS
T
'
])
def
upload
(
sha1
):
if
request
.
content_type
!=
'
audio/mpeg
'
:
log
.
error
(
'
attempted upload with wrong content-type (%s)
'
%
(
...
...
@@ -58,7 +58,10 @@ def run_receiver(port, storage_dir, db_url):
global
storage_root
storage_root
=
storage_dir
init_db
(
db_url
)
app
.
run
(
host
=
'
0.0.0.0
'
,
port
=
port
,
use_reloader
=
False
)
from
gevent.wsgi
import
WSGIServer
http_server
=
WSGIServer
((
'
0.0.0.0
'
,
port
),
app
)
http_server
.
serve_forever
()
def
main
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment