Hi,

I have this simple configuration:

db.define_table( 'files',
    Field('file','upload'))

@auth.requires_login()
def upload():
    db.files.id.default = request.args(0)
    form = crud.create(db.files)
    return dict(form=form)

If i remove authentication from upload() i can upload a file using
curl. But i would like apply the authentication restriction. So i
register a user with username: t...@nowhere.com and password:1111 and
i try the following command

curl --verbose -u t...@nowhere.com:1111 -F "file=@/home/thodoris/
Downloads/test.rtp" -F "_formname=files/None"  
http://127.0.0.1:8000/test/default/upload

and i get the following error message:

* About to connect() to 127.0.0.1 port 8000 (#0)
*   Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
* Server auth using Basic with user 't...@nowhere.com'
> POST /test/default/upload HTTP/1.1
> Authorization: Basic dGVzdEBub3doZXJlLmNvbToxMTEx
> User-Agent: curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o 
> zlib/1.2.3.4 libidn/1.18
> Host: 127.0.0.1:8000
> Accept: */*
> Content-Length: 3187083
> Expect: 100-continue
> Content-Type: multipart/form-data; 
> boundary=----------------------------69a14296aa8c
>
< HTTP/1.1 100 Continue
< HTTP/1.1 303 SEE OTHER
< Set-Cookie:  session_id_test=127.0.0.1-0054c564-830d-4fe4-
ae3d-924a1ba931b8; Path=/
< Content-Type: text/html; charset=UTF-8
* Avoided giant realloc for header (max is 102400)!
* Closing connection #0
curl: (27) Avoided giant realloc for header (max is 102400)!

Could anyone help me understand what the problem is and how to solve
it?

I have also tried setting

auth.settings.allow_basic_login=True in the models but still the same.

Reply via email to