|
Lines 19-24
Link Here
|
| 19 |
|
19 |
|
| 20 |
int rv, s, af; |
20 |
int rv, s, af; |
| 21 |
bool el; /* end of header line */ |
21 |
bool el, found=FALSE; /* end of header line */ |
| 22 |
char *cp, buf[PATH_MAX], req[BUFSIZ]; |
22 |
char *cp, *rel, buf[PATH_MAX], req[BUFSIZ]; |
| 23 |
struct addrinfo hints, *res, *res0; |
23 |
struct addrinfo hints, *res, *res0; |
| 24 |
|
24 |
|
|
Lines 49-54
Link Here
|
| 49 |
return FALSE; |
49 |
return FALSE; |
| 50 |
} |
50 |
} |
|
|
51 |
/* If the release is specified as "__RELEASE" or "none", then just |
| 52 |
* assume that the path the user gave is ok. |
| 53 |
*/ |
| 54 |
rel = variable_get(VAR_RELNAME); |
| 55 |
/* |
| 56 |
msgConfirm("rel: -%s-", rel); |
| 57 |
*/ |
| 58 |
if (strcmp(rel, "__RELEASE") && strcmp(rel, "none")) { |
| 59 |
sprintf(req, "%s/pub/FreeBSD/releases/"MACHINE"/%s", |
| 60 |
variable_get(VAR_FTP_PATH), rel); |
| 61 |
variable_set2(VAR_HTTP_PATH, req, 0); |
| 62 |
} else { |
| 63 |
variable_set2(VAR_HTTP_PATH, variable_get(VAR_FTP_PATH), 0); |
| 64 |
} |
| 51 |
|
65 |
|
| 52 |
sprintf(req,"GET / HTTP/1.0\r\n\r\n"); |
66 |
msgNotify("Checking access to\n %s", variable_get(VAR_HTTP_PATH)); |
|
|
67 |
sprintf(req,"HEAD %s/ HTTP/1.0\r\n\r\n", variable_get(VAR_HTTP_PATH)); |
| 53 |
write(s,req,strlen(req)); |
68 |
write(s,req,strlen(req)); |
| 54 |
/* |
69 |
/* |
|
Lines 64-67
Link Here
|
| 64 |
if ((*cp == '\012') && el) { |
79 |
if ((*cp == '\012') && el) { |
| 65 |
/* reached end of a header line */ |
80 |
/* reached end of a header line */ |
|
|
81 |
if (!strncmp(buf,"HTTP",4)) { |
| 82 |
if (strtol((char *)(buf+9),0,0) == 200) { |
| 83 |
found = TRUE; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 66 |
if (!strncmp(buf,"Server: ",8)) { |
87 |
if (!strncmp(buf,"Server: ",8)) { |
| 67 |
if (!strncmp(buf,"Server: Squid",13)) { |
88 |
if (!strncmp(buf,"Server: Squid",13)) { |
|
Lines 86-90
Link Here
|
| 86 |
} |
107 |
} |
| 87 |
close(s); |
108 |
close(s); |
| 88 |
return TRUE; |
109 |
if (!found) |
|
|
110 |
msgConfirm("No such directory: %s\n" |
| 111 |
"please check the URL and try again.", variable_get(VAR_HTTP_PATH)); |
| 112 |
return found; |
| 89 |
} |
113 |
} |
| 90 |
|
114 |
|
|
Lines 126-132
Link Here
|
| 126 |
} |
150 |
} |
| 127 |
|
151 |
|
| 128 |
sprintf(req,"GET %s/%s/%s%s HTTP/1.0\r\n\r\n", |
152 |
sprintf(req,"GET %s/%s%s HTTP/1.0\r\n\r\n", |
| 129 |
variable_get(VAR_FTP_PATH), variable_get(VAR_RELNAME), |
153 |
variable_get(VAR_HTTP_PATH), file, variable_get(VAR_HTTP_FTP_MODE)); |
| 130 |
file, variable_get(VAR_HTTP_FTP_MODE)); |
|
|
| 131 |
|
154 |
|
| 132 |
if (isDebug()) { |
155 |
if (isDebug()) { |