X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=tests%2Fclient.c;h=866afd13dd2a5f43e623019db6c0b5a613890b88;hb=a84000d1d2806c296bfc0fa4b505b5d5ef750715;hp=9bb23f392ab2831a896dc859d5fc76b9d05c6acc;hpb=d0b5d139253e5c599c9e675fc0a5677bda5a5a29;p=tlsproxy%2Ftlsproxy.git diff --git a/tests/client.c b/tests/client.c index 9bb23f3..866afd1 100644 --- a/tests/client.c +++ b/tests/client.c @@ -53,9 +53,10 @@ int main (int argc, char *argv[]) { const gnutls_datum_t *cert_list; unsigned int cert_list_size; - if (argc != 5) { + if (argc != 5 && argc != 6) { fprintf(stderr, - "Usage: %s \n", + "Usage: %s " + "[]\n", argv[0]); return EXIT_FAILURE; } @@ -82,6 +83,9 @@ int main (int argc, char *argv[]) { /* Talk to tlsproxy. */ fprintf(fd, "CONNECT %s:%s HTTP/1.0\r\n", argv[2], argv[3]); + if (argc == 6) { + fprintf(fd, "Proxy-Authorization: Basic %s\r\n", argv[5]); + } fprintf(fd, "\r\n"); fflush(fd); if (read_http_request(fd, buffer, sizeof(buffer)) == -1) { @@ -235,7 +239,7 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { return -2; } - while (fgets(buffer, MAX_REQUEST_LINE, client_fd) != NULL) { + while (fgets(buffer, sizeof(buffer), client_fd) != NULL) { /* End of header. */ if (!strcmp(buffer, "\n") || !strcmp(buffer, "\r\n")) { break;