diff --git a/http_lib.c b/http_lib.c index 281837c903..532e78382b 100644 --- a/http_lib.c +++ b/http_lib.c @@ -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 ); } diff --git a/http_test.c b/http_test.c new file mode 100644 index 0000000000..8dfd8cdb51 --- /dev/null +++ b/http_test.c @@ -0,0 +1,13 @@ +#include +#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); +}