View | Details | Raw Unified | Return to bug 21449
Collapse All | Expand All

(-)sysinstall.new/http.c (-7 / +30 lines)
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()) {
(-)sysinstall.new/media.c (-7 / +8 lines)
Lines 51-54 Link Here
51
51
52
static Boolean got_intr = FALSE;
52
static Boolean got_intr = FALSE;
53
static Boolean ftp_skip_resolve = FALSE;
53
54
54
/* timeout handler */
55
/* timeout handler */
Lines 393-397 Link Here
393
	msgDebug("port # = `%d'\n", FtpPort);
394
	msgDebug("port # = `%d'\n", FtpPort);
394
    }
395
    }
395
    if (variable_get(VAR_NAMESERVER)) {
396
    if (!ftp_skip_resolve && variable_get(VAR_NAMESERVER)) {
396
	msgNotify("Looking up host %s.", hostname);
397
	msgNotify("Looking up host %s.", hostname);
397
    	if (isDebug())
398
    	if (isDebug())
Lines 453-472 Link Here
453
int mediaSetHTTP(dialogMenuItem *self)
454
int mediaSetHTTP(dialogMenuItem *self)
454
{
455
{
456
    Boolean tmp;
455
    int result;
457
    int result;
456
    char *cp, *idx, hbuf[MAXHOSTNAMELEN], *hostname, *var_hostname;
458
    char *cp, *idx, hbuf[MAXHOSTNAMELEN], *hostname;
457
    int HttpPort;
459
    int HttpPort;
458
    int what = DITEM_RESTORE;
460
    int what = DITEM_RESTORE;
459
461
460
462
461
    var_hostname = variable_get(VAR_NAMESERVER);
463
    tmp = ftp_skip_resolve;
462
    variable_unset(VAR_NAMESERVER);
464
    ftp_skip_resolve = TRUE;
463
    result = mediaSetFTP(self);
465
    result = mediaSetFTP(self);
464
    if (var_hostname)
466
    ftp_skip_resolve = tmp;
465
	variable_set2(VAR_NAMESERVER, var_hostname, 0);
466
467
467
    if (DITEM_STATUS(result) != DITEM_SUCCESS)
468
    if (DITEM_STATUS(result) != DITEM_SUCCESS)
468
	return result;
469
	return result;
469
 
470
 
470
    cp = variable_get_value(VAR_HTTP_PATH,
471
    cp = variable_get_value(VAR_HTTP_PROXY,
471
	"Please enter the address of the HTTP proxy in this format:\n"
472
	"Please enter the address of the HTTP proxy in this format:\n"
472
	" hostname:port (the ':port' is optional, default is 3128)",0);
473
	" hostname:port (the ':port' is optional, default is 3128)",0);
(-)sysinstall.new/sysinstall.h (+1 lines)
Lines 113-116 Link Here
113
#define VAR_FTP_HOST			"ftpHost"
113
#define VAR_FTP_HOST			"ftpHost"
114
#define VAR_HTTP_PATH			"_httpPath"
114
#define VAR_HTTP_PATH			"_httpPath"
115
#define VAR_HTTP_PROXY			"httpProxy"
115
#define VAR_HTTP_PORT			"httpPort"
116
#define VAR_HTTP_PORT			"httpPort"
116
#define VAR_HTTP_HOST			"httpHost"
117
#define VAR_HTTP_HOST			"httpHost"

Return to bug 21449