mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 03:35:22 +00:00
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)
|
||||
{
|
||||
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,
|
||||
http_server,
|
||||
http_port,
|
||||
url,
|
||||
http_user_agent,
|
||||
http_server,
|
||||
additional_header
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
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,
|
||||
url,
|
||||
http_user_agent,
|
||||
http_server,
|
||||
additional_header
|
||||
);
|
||||
}
|
||||
|
13
http_test.c
Normal file
13
http_test.c
Normal file
@ -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…
x
Reference in New Issue
Block a user