summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c2
-rw-r--r--webfinger.c3
-rw-r--r--xs_curl.h5
3 files changed, 6 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c
index b20ae0f..c8c166d 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -672,7 +672,7 @@ xs_dict *msg_follow(snac *snac, const char *q)
672 if (xs_startswith(url_or_uid, "https:/")) 672 if (xs_startswith(url_or_uid, "https:/"))
673 actor = xs_dup(url_or_uid); 673 actor = xs_dup(url_or_uid);
674 else 674 else
675 if (!valid_status(webfinger_request(url_or_uid, &actor, NULL))) { 675 if (!valid_status(webfinger_request(url_or_uid, &actor, NULL)) || actor == NULL) {
676 snac_log(snac, xs_fmt("cannot resolve user %s to follow", url_or_uid)); 676 snac_log(snac, xs_fmt("cannot resolve user %s to follow", url_or_uid));
677 return NULL; 677 return NULL;
678 } 678 }
diff --git a/webfinger.c b/webfinger.c
index eb6b2ad..2f11516 100644
--- a/webfinger.c
+++ b/webfinger.c
@@ -85,7 +85,8 @@ int webfinger_request(const char *qs, char **actor, char **user)
85 if (xs_type(v) == XSTYPE_DICT) { 85 if (xs_type(v) == XSTYPE_DICT) {
86 char *type = xs_dict_get(v, "type"); 86 char *type = xs_dict_get(v, "type");
87 87
88 if (type && strcmp(type, "application/activity+json") == 0) { 88 if (type && (strcmp(type, "application/activity+json") == 0 ||
89 strcmp(type, "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") == 0)) {
89 *actor = xs_dup(xs_dict_get(v, "href")); 90 *actor = xs_dup(xs_dict_get(v, "href"));
90 break; 91 break;
91 } 92 }
diff --git a/xs_curl.h b/xs_curl.h
index ca90f92..d19d6e5 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -127,14 +127,15 @@ xs_dict *xs_http_request(const char *method, const char *url,
127 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _data_callback); 127 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _data_callback);
128 128
129 if (strcmp(method, "POST") == 0 || strcmp(method, "PUT") == 0) { 129 if (strcmp(method, "POST") == 0 || strcmp(method, "PUT") == 0) {
130 curl_easy_setopt(curl, method[1] == 'O' ? CURLOPT_POST : CURLOPT_UPLOAD, 1L); 130 CURLoption curl_method = method[1] == 'O' ? CURLOPT_POST : CURLOPT_UPLOAD;
131 curl_easy_setopt(curl, curl_method, 1L);
131 132
132 if (body != NULL) { 133 if (body != NULL) {
133 if (b_size <= 0) 134 if (b_size <= 0)
134 b_size = xs_size(body); 135 b_size = xs_size(body);
135 136
136 /* add the content-length header */ 137 /* add the content-length header */
137 curl_easy_setopt(curl, CURLOPT_INFILESIZE, b_size); 138 curl_easy_setopt(curl, curl_method == CURLOPT_POST ? CURLOPT_POSTFIELDSIZE : CURLOPT_INFILESIZE, b_size);
138 139
139 pd.data = (char *)body; 140 pd.data = (char *)body;
140 pd.size = b_size; 141 pd.size = b_size;