From 2a5dcba5edaaf241ea85ec6cad7ccd9665774ee4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 30 Jun 2008 02:43:13 +0000 Subject: http: initial rewrite using ringbuffer + pthreads This institutes the usage of a separate thread to buffer HTTP input. It is basically practice code for using the ringbuffer code which I plan on reusing for the OutputBuffer as well as further input buffering for disk (networked filesystems over WAN, laptops on battery, etc). Each readFromInputStream() call on an HTTP stream can take several seconds to complete, short reads are avoided. A single-threaded solution for systems supporting large enough SO_RCVBUF values should also be possible and will likely be done in the future; but this lock-free(except when full/empty) ringbuffer is cool :) git-svn-id: https://svn.musicpd.org/mpd/trunk@7393 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/inputStream_http_auth.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/inputStream_http_auth.h') diff --git a/src/inputStream_http_auth.h b/src/inputStream_http_auth.h index db4fb4584..2caf3a09d 100644 --- a/src/inputStream_http_auth.h +++ b/src/inputStream_http_auth.h @@ -27,7 +27,7 @@ #define BASE64_LENGTH(len) (4 * (((len) + 2) / 3)) -static char *base64Dup(char *s) +static char *base64dup(char *s) { int i; int len = strlen(s); @@ -64,8 +64,8 @@ static char *base64Dup(char *s) return ret; } -static char *authString(const char *header, - const char *user, const char *password) +static char *auth_string(const char *header, + const char *user, const char *password) { char *ret = NULL; int templen; @@ -80,7 +80,7 @@ static char *authString(const char *header, strcpy(temp, user); strcat(temp, ":"); strcat(temp, password); - temp64 = base64Dup(temp); + temp64 = base64dup(temp); free(temp); ret = xmalloc(strlen(temp64) + strlen(header) + 3); @@ -95,7 +95,7 @@ static char *authString(const char *header, #define PROXY_AUTH_HEADER "Proxy-Authorization: Basic " #define HTTP_AUTH_HEADER "Authorization: Basic " -#define proxyAuthString(x, y) authString(PROXY_AUTH_HEADER, x, y) -#define httpAuthString(x, y) authString(HTTP_AUTH_HEADER, x, y) +#define proxy_auth_string(x, y) auth_string(PROXY_AUTH_HEADER, x, y) +#define http_auth_string(x, y) auth_string(HTTP_AUTH_HEADER, x, y) #endif /* INPUT_STREAM_HTTP_AUTH_H */ -- cgit v1.2.3