~adam-stokes/ubuntu/quantal/gnome-vfs/lp977940-multiarch

« back to all changes in this revision

Viewing changes to debian/patches/90_from_svn_no_range_for_youtube.patch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-08-05 10:31:15 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080805103115-5vkex0yk6qq619x5
Tags: 1:2.23.0-0ubuntu1
* New upstream version:
  - Sync xdgmime with GIO
* debian/patches/90_from_svn_no_range_for_youtube.patch:
  - the change is in the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--- trunk/modules/http-neon-method.c    2008/03/18 15:57:07     5464
2
 
+++ trunk/modules/http-neon-method.c    2008/03/18 20:45:39     5465
3
 
@@ -1773,6 +1773,25 @@
4
 
        return GNOME_VFS_OK;
5
 
 }
6
 
 
7
 
+gboolean
8
 
+http_context_host_matches (HttpContext *context, const char *glob)
9
 
+{
10
 
+        GnomeVFSToplevelURI *uri;
11
 
+        GPatternSpec *spec;
12
 
+        gboolean res;
13
 
+
14
 
+        uri = gnome_vfs_uri_get_toplevel (context->uri);
15
 
+
16
 
+        if (uri == NULL ||  uri->host_name == NULL || glob == NULL)
17
 
+                return FALSE;
18
 
+
19
 
+        spec = g_pattern_spec_new (glob);
20
 
+        res = g_pattern_match_string (spec, uri->host_name);
21
 
+        g_pattern_spec_free (spec);
22
 
+
23
 
+        return res;
24
 
+}
25
 
+
26
 
 static GnomeVFSResult
27
 
 http_follow_redirect (HttpContext *context)
28
 
 {
29
 
@@ -2255,7 +2274,7 @@
30
 
        hctx = handle->context;
31
 
        
32
 
 get_start:     
33
 
-       req  = ne_request_create (hctx->session, "GET", hctx->path);
34
 
+       req = ne_request_create (hctx->session, "GET", hctx->path);
35
 
        
36
 
        if (handle->use_range) {
37
 
                
38
 
@@ -2330,8 +2349,8 @@
39
 
 
40
 
                handle->transfer_state = TRANSFER_READ;
41
 
                handle->transfer.read = req;
42
 
-       }
43
 
-       
44
 
+       } 
45
 
+
46
 
        return result;
47
 
 }
48
 
 
49
 
@@ -2347,6 +2366,20 @@
50
 
        return GNOME_VFS_ERROR_INTERNAL;
51
 
 }
52
 
 
53
 
+/* TRUE means we can range, ie server is sane, FALSE means FAIL */
54
 
+static gboolean
55
 
+i_can_haz_range_cause_serverz_not_br0ken (HttpContext *hctx)
56
 
+{
57
 
+        gboolean br0ken = FALSE;
58
 
+
59
 
+        if (http_context_host_matches (hctx, "*youtube.*")) {
60
 
+                DEBUG_HTTP ("Youtube detected! Cannot use ranged gets");
61
 
+                br0ken = TRUE;
62
 
+        }
63
 
+
64
 
+        return br0ken == FALSE;
65
 
+}
66
 
+
67
 
 /* ************************************************************************** */
68
 
 
69
 
 static GnomeVFSResult
70
 
@@ -2402,8 +2435,10 @@
71
 
                        return result;
72
 
                } 
73
 
        } else {
74
 
-                /* Always try to make Ranged puts */
75
 
-               handle->use_range = TRUE;
76
 
+                gboolean use_range = TRUE;
77
 
+
78
 
+               handle->use_range = i_can_haz_range_cause_serverz_not_br0ken (hctx);
79
 
+                DEBUG_HTTP ("Use range: %s\n", use_range ? "on" : "off");
80
 
        }
81
 
 
82
 
        result = http_transfer_start (handle);  
83