aitjcize / cppman

C++ 98/11/14 manual pages for Linux/MacOS
GNU General Public License v3.0
1.27k stars 79 forks source link

The cppreference.com fails to cache #115

Closed edgar444 closed 3 years ago

edgar444 commented 3 years ago

Version of cppman:

$ cppman -v |& head -1
/usr/bin/cppman Ver 0.4.9
$ qfile -vS $(which cppman)
app-doc/cppman-0.4.9:0: /usr/bin/cppman

Caching fails when switched to different source:

$ cppman --source=cppreference.com
Source set to `cppreference.com'.
$ cppman -c
By default, cppman fetches pages on-the-fly if corresponding page is not found in the cache. The "cache-all" option is only useful if you want to view man pages offline. Caching all contents will take several minutes, do you want to continue [y/N]? y
Caching manpages from cppreference.com ...
Caching std::numeric_limits::round_error ...
Retrying ...
Retrying ...
Retrying ...
Error caching std::numeric_limits::round_error ...
Caching C++ concepts: Destructible ...
Retrying ...
Retrying ...
Retrying ...
Error caching C++ concepts: Destructible ...
Caching Move constructors ...
Retrying ...
Retrying ...
Retrying ...

The server tries to redirect to en.cppreference.com, which is the cause of the issue:

15632 1595712908.061793 (+     0.000770) [00007efffb974ffc] sendto(6<TCP:[192.168.1.147:51380->74.114.90.46:80]>, "GET /w/cpp/language/operator_member_access HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: en.cppreference.com\r\nUser-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n", 159, 0, NULL, 0) = 159 <0.000019>
15632 1595712908.061887 (+     0.000093) [00007efffb974ddc] recvfrom(6<TCP:[192.168.1.147:51380->74.114.90.46:80]>, "HTTP/1.1 302 Found\r\nDate: Sat, 25 Jul 2020 21:34:44 GMT\r\nServer: Apache\r\nTT-Server: t=1595712884616257 D=2377\r\nLocation: https://en.cppreference.com/w/cpp/language/operator_member_access\r\nCache-Control: max-age=2592000\r\nExpires: Mon, 24 Aug 2020 21:34:44 GMT\r\nContent-Length: 249\r\nConnection: close\r\nContent-Type: text/html; charset=iso-8859-1\r\n\r\n<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>302 Found</title>\n</head><body>\n<h1>Found</h1>\n<p>The document has moved <a href=\"https://en.cppreference.com/w/cpp/language/operator_member_access\">here</a>.</p>\n</body></html>\n", 8192, 0, NULL, NULL) = 596 <0.172419>