25 lines
393 B
C
25 lines
393 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 = calloc(buflen, sizeof(char))))
|
|
{
|
|
return(ERRMEM);
|
|
}
|
|
|
|
sprintf(*nbuf, REQ_HTTP, path, fqdn);
|
|
|
|
|
|
return(0);
|
|
}
|