From 67ed42849377c1956a6e5b6098761665f7fe10a5 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 28 Apr 2012 00:35:28 -0400 Subject: [PATCH] merge http code --- http.0.9.c | 81 -------------------------------------------- http.1.0.c => http.c | 0 2 files changed, 81 deletions(-) delete mode 100644 http.0.9.c rename http.1.0.c => http.c (100%) diff --git a/http.0.9.c b/http.0.9.c deleted file mode 100644 index 1a890d5..0000000 --- a/http.0.9.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * HTTP 0.9 - * - * request: - * GET url CR LF - * - * response: - * data EOF - * - * http://www.w3.org/Protocols/HTTP/AsImplemented.html - * - */ -#pragma optimize 79 -#pragma noroot - -#include -#include -#include - -#include - -#include "url.h" -#include "connection.h" -#include "prototypes.h" - -int do_http_0_9(const char *url, URLComponents *components, FILE *file) -{ - char *host; - Connection connection; - int ok; - - if (!components->portNumber) components->portNumber = 80; - - - host = URLComponentGetCMalloc(url, components, URLComponentHost); - - if (!host) - { - fprintf(stderr, "URL `%s': no host.", url); - return -1; - } - - ok = ConnectLoop(host, components->portNumber, &connection); - - if (!ok) - { - free(host); - return -1; - } - - - // connected.... - TCPIPWriteTCP(connection.ipid, "GET ", 4, false, false); - - if (components->pathAndQuery.length) - { - const char *path = url + components->pathAndQuery.location; - int length = components->pathAndQuery.length; - - TCPIPWriteTCP(connection.ipid, path, length, false, false); - } - else - { - TCPIPWriteTCP(connection.ipid, "/", 1, false, false); - } - - TCPIPWriteTCP(connection.ipid, "\r\n", 2, true, false); - - // read until eof. - - ok = read_binary(connection.ipid, file); - - fflush(file); - - CloseLoop(&connection); - free(host); - - return 0; - -} - \ No newline at end of file diff --git a/http.1.0.c b/http.c similarity index 100% rename from http.1.0.c rename to http.c