79 |
char proto[STRLEN]; |
char proto[STRLEN]; |
80 |
char request[REQ_LENGTH]; |
char request[REQ_LENGTH]; |
81 |
|
|
82 |
|
ASSERT(p); |
83 |
|
|
84 |
snprintf(request, REQ_LENGTH, |
snprintf(request, REQ_LENGTH, |
85 |
"GET %s HTTP/1.1\r\n" |
"GET %s HTTP/1.1\r\n" |
86 |
"Host: %s\r\n" |
"Host: %s\r\n" |
90 |
p->request?p->request:"/", |
p->request?p->request:"/", |
91 |
get_host_header(p, host), prog, VERSION); |
get_host_header(p, host), prog, VERSION); |
92 |
|
|
93 |
if (port_send(p, request, strlen(request), 0) < 0) { |
if(port_send(p, request, strlen(request), 0) < 0) { |
94 |
log("HTTP: error sending data -- %s\n", STRERROR); |
log("HTTP: error sending data -- %s\n", STRERROR); |
95 |
return FALSE; |
return FALSE; |
96 |
} |
} |
97 |
|
|
98 |
if (port_recv(p, buf, sizeof(buf), 0) <= 0) { |
if(port_recv(p, buf, sizeof(buf), 0) <= 0) { |
99 |
log("HTTP: error receiving data -- %s\n", STRERROR); |
log("HTTP: error receiving data -- %s\n", STRERROR); |
100 |
return FALSE; |
return FALSE; |
101 |
} |
} |
122 |
*/ |
*/ |
123 |
static char *get_host_header(Port_T p, char *hostbuf) { |
static char *get_host_header(Port_T p, char *hostbuf) { |
124 |
|
|
125 |
if ( ! strcmp(LOCALHOST, p->hostname) || inet_aton(p->hostname, NULL) ) { |
if(! strcmp(LOCALHOST, p->hostname) || inet_aton(p->hostname, NULL)) { |
126 |
|
|
127 |
*hostbuf= 0; |
*hostbuf= 0; |
128 |
|
|