apportate/src/http.c

26 lines
401 B
C

#include "headers.h"
const char REQ_HTTP[] =
{
"GET %s HTTP/1.0\r\nHost: %s\r\n\r\n"
};
int reqgen_http(const char *path, const char *fqdn, char **nbuf)
{
int buflen;
buflen = (strlen(REQ_HTTP) + strlen(path) + strlen(fqdn) + 1);
if( !(*nbuf = malloc(buflen)))
{
return(ERRMEM);
}
memset(*nbuf, 0, buflen);
sprintf(*nbuf, REQ_HTTP, path, fqdn);
return(0);
}