Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http模式 上传base64文件大小问题 #49

Closed
SuperMMORPG opened this issue Nov 6, 2023 · 3 comments
Closed

http模式 上传base64文件大小问题 #49

SuperMMORPG opened this issue Nov 6, 2023 · 3 comments

Comments

@SuperMMORPG
Copy link

SuperMMORPG commented Nov 6, 2023

http服务 上传文件的时候,如果转过来的图片base64信息比较大。
web服务器会返回 413 Request Entity Too Large 问题。

@SuperMMORPG SuperMMORPG changed the title http http模式 上传base64文件大小问题 Nov 6, 2023
@SuperMMORPG
Copy link
Author

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
    <head>
        <title>Error: 413 Request Entity Too Large</title>
        <style type="text/css">
          html {background-color: #eee; font-family: sans;}
          body {background-color: #fff; border: 1px solid #ddd;
                padding: 15px; margin: 15px;}
          pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
        </style>
    </head>
    <body>
        <h1>Error: 413 Request Entity Too Large</h1>
        <p>Sorry, the requested URL <tt>&#039;http://127.0.0.1:1224/api/ocr&#039;</tt>
           caused an error:</p>
        <pre>Request to large</pre>
    </body>
</html>

@hiroi-sora
Copy link
Owner

hiroi-sora commented Nov 6, 2023

确实,我没考虑到请求大小的问题。

你可以通过下述操作调整请求大小:

  1. 打开文件
UmiOCR-data\py_src\server\bottle.py
  1. 第1131行左右,原本是:
    #: Maximum size of memory buffer for :attr:`body` in bytes.
    MEMFILE_MAX = 102400

将它改为:

    #: Maximum size of memory buffer for :attr:`body` in bytes.
    MEMFILE_MAX = 10485760

这将设置单次请求上限为10MB。你可以改为别的值。

请测试该方法是否有效。我将在下次更新修复此问题。

参考:
https://www.osgeo.cn/bottle/api.html
https://stackoverflow.com/questions/16865997/python-bottle-module-causes-error-413-request-entity-too-large

@SuperMMORPG
Copy link
Author

设置后, 方法可行。 感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants