2016-11-23 101 views
0

我试图挽救谷歌图片搜索结果的图像,但是当我在查询字符串参数发送图像的src它提供了以下错误:的Ubuntu 16.04 - 阿帕奇2.4.18 - 请求URI太长

Request-URI Too Long 
The requested URL's length exceeds the capacity limit for this server. 

Apache/2.4.18 (Ubuntu) Server at 127.0.1.1 Port 80 

由于我在本地机器上发现了这个错误,所以我可以测试你所有的想法。

注意:我确实在/etc/apache2/apache2.conf文件中将LimitRequestLineLimitRequestFieldSize设置为100000。但到目前为止没有运气。

任何帮助表示赞赏。

回答

2

请求参数不能有无限长度。我的猜测是当发送图像src作为查询参数时,你达到了最大长度。

this answer here看来,您可以将LimitRequestLineLimitRequestFieldSize设置为最大8192个字节或任何低于(不高于)该值的任何值。

And in Apache, if you use that as a webservers, you can limit it to something below the default 8190 bytes, but not to something above it without changing the source code & recompiling.

读也this question其中有大量的详细信息,您的网址的最大长度:

This is a popular question, and as the original research is ~9 years old I'll try to keep it up to date: As of Nov 2016, the advice still stands. Even though IE11 may possibly accept longer URLs, the ubiquity of older IE installations plus the search engine limitations mean staying under 2000 chars is the best general policy.

换句话说:尽量保持在2000个字符,并使用POST发送大量数据...

+0

非常有用,因为我没有检查“重新编译的web服务器”所在的行,如果该数字更大,就像我所要求的那样。 是的,有想到'POST',但它不可能在我的情况。至于'GET',我会忽略'src'的值超过'2000'的值。 –

+0

@KunalDethe很高兴我的回答很有帮助。为什么只限于使用'GET'而不是'POST'?你能对此发光吗? – Wilt

+0

我正在构建一个浏览器扩展,它应该为我提供一个选项,通过在图像上提供按钮等下载来保存图像。但是为了下载发生,它会将页面加载到iframe中,并从查询字符串中获取src。 –