Package: snarf
Version: 7.0-3
Severity: normal
Tags: patch

$ snarf http://www.google.com/search\?q=futility
error: HTTP error from server: HTTP/1.0 403 Forbidden
$ snarf -z http://www.google.com/search\?q=futility
http://www.google.com/search?q=futility (unknown size)
search?q=futility         [|]      14K
15052 bytes transferred in 2.63 sec (5.59k/sec)
$

Unbelievable. And these are the "don't be evil" people?

diff -u snarf-7.0.orig/http.c snarf-7.0/http.c
--- snarf-7.0.orig/http.c       2000-08-08 19:33:30.000000000 -0500
+++ snarf-7.0/http.c    2006-05-26 17:47:14.000000000 -0500
@@ -222,6 +222,17 @@
 
         request = strconcat(request, "User-Agent: ", NULL);
 
+        /* How silly of google to blacklist snarf by User-Agent.
+           Well, we can be silly too. */
+        if (!(rsrc->options & (OPT_BE_MOZILLA|OPT_BE_MSIE))) {
+            if (!strcmp(u->host, "google.com") ||
+                (strlen(u->host) > strlen("google.com") &&
+                 !strcmp(u->host+(strlen(u->host)-strlen("google.com"))-1,
+                         ".google.com"))) {
+                rsrc -> options |= OPT_BE_MOZILLA;
+            }
+        }
+
         if (getenv("SNARF_HTTP_USER_AGENT")) {
             request = strconcat(request, getenv("SNARF_HTTP_USER_AGENT"), 
                                 NULL);

-- System Information:
Debian Release: 3.1
Architecture: powerpc (ppc)
Kernel: Linux 2.6.16.14
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages snarf depends on:
ii  libc6                 2.3.2.ds1-22sarge3 GNU C Library: Shared libraries an

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to