summaryrefslogtreecommitdiffstats
path: root/loader2/ftp.c
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2003-07-07 21:06:31 +0000
committerMike Fulbright <msf@redhat.com>2003-07-07 21:06:31 +0000
commit4394fd0521de56b6021fddf07faf34cac9a15910 (patch)
tree03ed3fbe1f084eed0211b01b614c1ce77ccfca01 /loader2/ftp.c
parentf879397d3c610caee34eb5b8301467cf7a406743 (diff)
downloadanaconda-4394fd0521de56b6021fddf07faf34cac9a15910.tar.gz
anaconda-4394fd0521de56b6021fddf07faf34cac9a15910.tar.xz
anaconda-4394fd0521de56b6021fddf07faf34cac9a15910.zip
support for sending MAC address as an HTTP header, needed for RHN provisioning
Diffstat (limited to 'loader2/ftp.c')
-rw-r--r--loader2/ftp.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/loader2/ftp.c b/loader2/ftp.c
index 8dede50ef..569e26602 100644
--- a/loader2/ftp.c
+++ b/loader2/ftp.c
@@ -418,16 +418,21 @@ const char *ftpStrerror(int errorNumber) {
return("FTP Unknown or unexpected error");
}
}
-
-int httpGetFileDesc(char * hostname, int port, char * remotename) {
+
+/* extraHeaders is either NULL or a string with extra headers separated by '\r\n', ending with
+ * '\r\n'
+ */
+int httpGetFileDesc(char * hostname, int port, char * remotename, char *extraHeaders) {
char * buf;
struct timeval timeout;
char headers[4096];
char * nextChar = headers;
+ char *hstr;
int checkedCode;
struct in_addr serverAddress;
int sock;
int rc;
+ int hlen;
struct sockaddr_in destPort;
fd_set readSet;
@@ -449,8 +454,13 @@ int httpGetFileDesc(char * hostname, int port, char * remotename) {
return FTPERR_FAILED_CONNECT;
}
- buf = alloca(strlen(remotename) + strlen(hostname) + 25);
- sprintf(buf, "GET %s HTTP/1.0\t\nHost: %s\r\n\r\n", remotename, hostname);
+ if (extraHeaders)
+ hstr = extraHeaders;
+ else
+ hstr = "";
+
+ buf = alloca(strlen(remotename) + strlen(hostname) + strlen(hstr) + 25);
+ sprintf(buf, "GET %s HTTP/1.0\t\nHost: %s\r\n%s\r\n", remotename, hostname, hstr);
write(sock, buf, strlen(buf));
/* This is fun; read the response a character at a time until we: