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
8
+http_context_host_matches (HttpContext *context, const char *glob)
10
+ GnomeVFSToplevelURI *uri;
14
+ uri = gnome_vfs_uri_get_toplevel (context->uri);
16
+ if (uri == NULL || uri->host_name == NULL || glob == NULL)
19
+ spec = g_pattern_spec_new (glob);
20
+ res = g_pattern_match_string (spec, uri->host_name);
21
+ g_pattern_spec_free (spec);
27
http_follow_redirect (HttpContext *context)
30
hctx = handle->context;
33
- req = ne_request_create (hctx->session, "GET", hctx->path);
34
+ req = ne_request_create (hctx->session, "GET", hctx->path);
36
if (handle->use_range) {
40
handle->transfer_state = TRANSFER_READ;
41
handle->transfer.read = req;
49
@@ -2347,6 +2366,20 @@
50
return GNOME_VFS_ERROR_INTERNAL;
53
+/* TRUE means we can range, ie server is sane, FALSE means FAIL */
55
+i_can_haz_range_cause_serverz_not_br0ken (HttpContext *hctx)
57
+ gboolean br0ken = FALSE;
59
+ if (http_context_host_matches (hctx, "*youtube.*")) {
60
+ DEBUG_HTTP ("Youtube detected! Cannot use ranged gets");
64
+ return br0ken == FALSE;
67
/* ************************************************************************** */
70
@@ -2402,8 +2435,10 @@
74
- /* Always try to make Ranged puts */
75
- handle->use_range = TRUE;
76
+ gboolean use_range = TRUE;
78
+ handle->use_range = i_can_haz_range_cause_serverz_not_br0ken (hctx);
79
+ DEBUG_HTTP ("Use range: %s\n", use_range ? "on" : "off");
82
result = http_transfer_start (handle);