This HTTP thing works now. Also add a test tool.
This commit is contained in:
parent
c37249baf7
commit
8ce7410a0c
|
@ -204,22 +204,24 @@ static http_retcode http_query(const char *command, const char *url, const char
|
||||||
if (proxy)
|
if (proxy)
|
||||||
{
|
{
|
||||||
sprintf(header,
|
sprintf(header,
|
||||||
"%s http://%.128s:%d/%.256s HTTP/1.0\015\012User-Agent: %s\015\012%s\015\012",
|
"%s http://%.128s:%d/%.256s HTTP/1.0\015\012User-Agent: %s\015\012Host: %s\015\012%s\015\012",
|
||||||
command,
|
command,
|
||||||
http_server,
|
http_server,
|
||||||
http_port,
|
http_port,
|
||||||
url,
|
url,
|
||||||
http_user_agent,
|
http_user_agent,
|
||||||
|
http_server,
|
||||||
additional_header
|
additional_header
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(header,
|
sprintf(header,
|
||||||
"%s /%.256s HTTP/1.0\015\012User-Agent: %s\015\012%s\015\012",
|
"%s /%.256s HTTP/1.0\015\012User-Agent: %s\015\012Host: %s\015\012%s\015\012",
|
||||||
command,
|
command,
|
||||||
url,
|
url,
|
||||||
http_user_agent,
|
http_user_agent,
|
||||||
|
http_server,
|
||||||
additional_header
|
additional_header
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "http_lib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char url[]="http://unicodesnowmanforyou.com/";
|
||||||
|
char* urlfilename=NULL;
|
||||||
|
http_parse_url(url, &urlfilename);
|
||||||
|
char * out;
|
||||||
|
http_retcode status=http_get(urlfilename, &out, NULL, NULL);
|
||||||
|
if (status<0) printf("%i - failure...\n", status);
|
||||||
|
else printf("%i - success - %s\n", status, out);
|
||||||
|
}
|
Loading…
Reference in New Issue