The R Project SVN R

Rev

Rev 68898 | Rev 82107 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68898 Rev 73914
Line 38... Line 38...
38
    b <- strsplit(c(head, junk), "\n")
38
    b <- strsplit(c(head, junk), "\n")
39
    nn <- length(b[[1]])
39
    nn <- length(b[[1]])
40
    if (length(b[[2]]) > nn)
40
    if (length(b[[2]]) > nn)
41
        data <- paste(b[[2]][-(1:nn)], collapse = "\n")
41
        data <- paste(b[[2]][-(1:nn)], collapse = "\n")
42
    while (nchar(data) < len) {
42
    while (nchar(data) < len) {
43
        data <- paste(data, read.socket(a, maxlen = len - nchar(data)),
43
        new_data <- read.socket(a, maxlen = len - nchar(data))
44
                      sep = "")
44
        if (new_data == "") break
-
 
45
        data <- paste(data, new_data, sep = "")
45
    }
46
    }
46
    strsplit(data, "\n")[[1]]
47
    strsplit(data, "\n")[[1]]
47
}
48
}
48
 
49
 
49
if(nzchar(Sys.getenv("http_proxy")) || nzchar(Sys.getenv("HTTP_PROXY"))) {
50
if(nzchar(Sys.getenv("http_proxy")) || nzchar(Sys.getenv("HTTP_PROXY"))) {
50
    cat("http proxy is set, so skip test of http over sockets\n")
51
    cat("http proxy is set, so skip test of http over sockets\n")
51
} else {
52
} else {
52
    f <- httpget("http://www.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat")
53
    f <- httpget("http://www.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat")
53
    str(f)
54
    str(f)
54
    stopifnot(length(f) == 100L)
55
    if (length(f) != 100L) stop("Data not fetched via socket")
55
}
56
}