summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile5
-rw-r--r--inc/libs3.h9
-rw-r--r--src/bucket.c4
-rw-r--r--src/request.c8
-rw-r--r--src/s3.c2
-rw-r--r--src/util.c12
6 files changed, 28 insertions, 12 deletions
diff --git a/GNUmakefile b/GNUmakefile
index b8086c8..e74049e 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -89,7 +89,8 @@ endif
CFLAGS += -Wall -Werror -std=c99 -Iinc \
$(CURL_CFLAGS) $(LIBXML2_CFLAGS) \
-DLIBS3_VER_MAJOR=\"$(LIBS3_VER_MAJOR)\" \
- -DLIBS3_VER_MINOR=\"$(LIBS3_VER_MINOR)\"
+ -DLIBS3_VER_MINOR=\"$(LIBS3_VER_MINOR)\" \
+ -DLIBS3_VER=\"$(LIBS3_VER)\"
LDFLAGS = $(CURL_LIBS) $(LIBXML2_LIBS) -lpthread
@@ -116,7 +117,7 @@ install: libs3 s3 headers
install -Dps -m u+rwx,go+rx $(BUILD)/bin/s3 $(DESTDIR)/bin/s3
install -Dp -m u+rw,go+r $(BUILD)/include/libs3.h \
$(DESTDIR)/include/libs3.h
- install -Dps -m u+rw,go+r $(BUILD)/lib/libs3.a $(DESTDIR)/lib/libs3.a
+ install -Dp -m u+rw,go+r $(BUILD)/lib/libs3.a $(DESTDIR)/lib/libs3.a
install -Dps -m u+rw,go+r $(BUILD)/lib/libs3.so.$(LIBS3_VER_MAJOR) \
$(DESTDIR)/lib/libs3.so.$(LIBS3_VER)
ln -sf libs3.so.$(LIBS3_VER) $(DESTDIR)/lib/libs3.so.$(LIBS3_VER_MAJOR)
diff --git a/inc/libs3.h b/inc/libs3.h
index a58b718..0605e7b 100644
--- a/inc/libs3.h
+++ b/inc/libs3.h
@@ -31,6 +31,11 @@
#include <sys/time.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/** **************************************************************************
* Overview
* --------
@@ -1711,4 +1716,8 @@ void S3_set_acl(const S3BucketContext *bucketContext, const char *key,
**/
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LIBS3_H */
diff --git a/src/bucket.c b/src/bucket.c
index 47f0ce2..a2446df 100644
--- a/src/bucket.c
+++ b/src/bucket.c
@@ -524,7 +524,7 @@ static S3Status listBucketXmlCallback(const char *elementPath,
(contents->ownerDisplayName, data, dataLen, fit);
}
else if (!strcmp(elementPath,
- "ListBucketResult/CommonPrefix/Prefix")) {
+ "ListBucketResult/CommonPrefixes/Prefix")) {
int which = lbData->commonPrefixesCount;
lbData->commonPrefixLens[which] +=
snprintf(lbData->commonPrefixes[which],
@@ -556,7 +556,7 @@ static S3Status listBucketXmlCallback(const char *elementPath,
}
}
else if (!strcmp(elementPath,
- "ListBucketResult/CommonPrefix/Prefix")) {
+ "ListBucketResult/CommonPrefixes/Prefix")) {
// Finished a Prefix
lbData->commonPrefixesCount++;
if (lbData->commonPrefixesCount == MAX_COMMON_PREFIXES) {
diff --git a/src/request.c b/src/request.c
index 57b2f54..8b4df63 100644
--- a/src/request.c
+++ b/src/request.c
@@ -893,7 +893,7 @@ static S3Status setup_curl(Request *request,
// Set URI
curl_easy_setopt_safe(CURLOPT_URL, request->uri);
- // Set request type
+ // Set request type.
switch (params->httpRequestType) {
case HttpRequestTypeHEAD:
curl_easy_setopt_safe(CURLOPT_NOBODY, 1);
@@ -920,6 +920,12 @@ static void request_deinitialize(Request *request)
}
error_parser_deinitialize(&(request->errorParser));
+
+ // curl_easy_reset prevents connections from being re-used for some
+ // reason. This makes HTTP Keep-Alive meaningless and is very bad for
+ // performance. But it is necessary to allow curl to work properly.
+ // xxx todo figure out why
+ curl_easy_reset(request->curl);
}
diff --git a/src/s3.c b/src/s3.c
index 1dad3bc..be709fe 100644
--- a/src/s3.c
+++ b/src/s3.c
@@ -661,7 +661,7 @@ static struct option longOptionsG[] =
{ "force", no_argument, 0, 'f' },
{ "vhost-style", no_argument, 0, 'h' },
{ "unencrypted", no_argument, 0, 'u' },
- { "show-proerties", no_argument, 0, 's' },
+ { "show-properties", no_argument, 0, 's' },
{ "retries", required_argument, 0, 'r' },
{ 0, 0, 0, 0 }
};
diff --git a/src/util.c b/src/util.c
index 3f1a9c9..f4292dc 100644
--- a/src/util.c
+++ b/src/util.c
@@ -28,9 +28,6 @@
#include <string.h>
#include "util.h"
-static const char *urlSafeG = "-_.!~*'()/";
-static const char *hexG = "0123456789ABCDEF";
-
// Convenience utility for making the code look nicer. Tests a string
// against a format; only the characters specified in the format are
@@ -59,13 +56,16 @@ static int checkString(const char *str, const char *format)
int urlEncode(char *dest, const char *src, int maxSrcSize)
{
+ static const char *urlSafe = "-_.!~*'()/";
+ static const char *hex = "0123456789ABCDEF";
+
int len = 0;
if (src) while (*src) {
if (++len > maxSrcSize) {
return 0;
}
- const char *urlsafe = urlSafeG;
+ const char *urlsafe = urlSafe;
int isurlsafe = 0;
while (*urlsafe) {
if (*urlsafe == *src) {
@@ -83,8 +83,8 @@ int urlEncode(char *dest, const char *src, int maxSrcSize)
}
else {
*dest++ = '%';
- *dest++ = hexG[*src / 16];
- *dest++ = hexG[*src % 16];
+ *dest++ = hex[*src / 16];
+ *dest++ = hex[*src % 16];
src++;
}
}