Next: Implementing the HTTP Client Function ‘parse_url’, Up: Steps in Implementing an Insecure HTTP Client [Index]
Start with all of the #include
’s and #define
’s that go along with socket
communication, shown in Listing 1-1.
/** * This test utility does simple (non-encrypted) HTTP */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #define HTTP_PORT 80 #define BUFFER_SIZE 255 #define MAX_GET_COMMAND 255