Discussion:
[bottlepy] How to sett the max_request_body_size in waitress
Johan Sandén
2016-07-13 11:17:35 UTC
Permalink
Im using Bottle with waitress as server, like this:
bottle.run(server='waitress', host=host, port=port)

I want be able to upload (post) a file that can be 4GB, so I have tried to
set the MEMFILE_MAX like this:

import bottle
bottle.BaseRequest.MEMFILE_MAX = 4294967296

...but i still get error:

Tue Jul 12 16:55:57 CEST 2016
Request Entity Too Large

exceeds max_body of 1073741824

(generated by waitress)

I have found that it is value of max_request_body_size in waitress that has
to be change, but I can't find a way to do that from bottle.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Iuri
2016-07-13 12:01:00 UTC
Permalink
All **kwargs unknown values passed to bottle.run are passed upstream to the
server handler, so you just have to set the max_request_body_size.

https://github.com/bottlepy/bottle/blob/master/bottle.py#L3480

bottle.run(server='waitress', host=host, port=port,
*max_request_body_size=bottle.BaseRequest.MEMFILE_MAX*)
Post by Johan Sandén
bottle.run(server='waitress', host=host, port=port)
I want be able to upload (post) a file that can be 4GB, so I have tried to
import bottle
bottle.BaseRequest.MEMFILE_MAX = 4294967296
Tue Jul 12 16:55:57 CEST 2016
Request Entity Too Large
exceeds max_body of 1073741824
(generated by waitress)
I have found that it is value of max_request_body_size in waitress that
has to be change, but I can't find a way to do that from bottle.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Marcel Hellkamp
2016-07-13 12:34:59 UTC
Permalink
Please note that bottles MEMFILE_MAX changes the maximum amount of data
per request that is held in RAM. It does not limit the upload file size.
In fact, there is no such limit in bottle. Files bigger than MEMFILE_MAX
are simply written to temporary files.

Setting MEMFILE_MAX to 4GB will eat up your servers memory very quickly.
Don't do that.
Post by Iuri
All **kwargs unknown values passed to bottle.run are passed upstream
to the server handler, so you just have to set the max_request_body_size.
https://github.com/bottlepy/bottle/blob/master/bottle.py#L3480
bottle.run(server='waitress', host=host, port=port,
*max_request_body_size=bottle.BaseRequest.MEMFILE_MAX*)
|
bottle.run(server='waitress',host=host,port=port)
|
I want be able to upload (post) a file that can be 4GB, so I have
|
importbottle
bottle.BaseRequest.MEMFILE_MAX =4294967296 <tel:4294967296>
|
|
TueJul1216:55:57CEST 2016
RequestEntityTooLarge
exceeds max_body of 1073741824
(generated bywaitress)
|
I have found that it is value of max_request_body_size in waitress
that has to be change, but I can't find a way to do that from bottle.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google
Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Johan Sandén
2016-07-13 13:11:01 UTC
Permalink
Okay, thanks!
Post by Marcel Hellkamp
Please note that bottles MEMFILE_MAX changes the maximum amount of data
per request that is held in RAM. It does not limit the upload file size. In
fact, there is no such limit in bottle. Files bigger than MEMFILE_MAX are
simply written to temporary files.
Setting MEMFILE_MAX to 4GB will eat up your servers memory very quickly.
Don't do that.
All **kwargs unknown values passed to bottle.run are passed upstream to
the server handler, so you just have to set the max_request_body_size.
https://github.com/bottlepy/bottle/blob/master/bottle.py#L3480
bottle.run(server='waitress', host=host, port=port,
*max_request_body_size=bottle.BaseRequest.MEMFILE_MAX*)
Post by Johan Sandén
bottle.run(server='waitress', host=host, port=port)
I want be able to upload (post) a file that can be 4GB, so I have tried
import bottle
bottle.BaseRequest.MEMFILE_MAX = 4294967296
Tue Jul 12 16:55:57 CEST 2016
Request Entity Too Large
exceeds max_body of 1073741824
(generated by waitress)
I have found that it is value of max_request_body_size in waitress that
has to be change, but I can't find a way to do that from bottle.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups
"bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...