2016-11-23 102 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。 –