Skip to content

Commit 79781c2

Browse files
authored
Merge pull request #165 from robe2/handle-unknown-with-body
Handle data element for HTTP_UNKNOWN
2 parents 01d4431 + 3aeaf1d commit 79781c2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

http.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,22 +1195,22 @@ Datum http_request(PG_FUNCTION_ARGS)
11951195

11961196
CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDS, text_to_cstring(content_text));
11971197
}
1198-
else if ( method == HTTP_PUT || method == HTTP_PATCH )
1198+
else if ( method == HTTP_PUT || method == HTTP_PATCH || method == HTTP_UNKNOWN )
11991199
{
12001200
if ( method == HTTP_PATCH )
12011201
CURL_SETOPT(g_http_handle, CURLOPT_CUSTOMREQUEST, "PATCH");
1202+
1203+
/* Assume the user knows what they are doing and pass unchanged */
1204+
if ( method == HTTP_UNKNOWN )
1205+
CURL_SETOPT(g_http_handle, CURLOPT_CUSTOMREQUEST, method_str);
1206+
12021207
initStringInfo(&si_read);
12031208
appendBinaryStringInfo(&si_read, VARDATA(content_text), content_size);
12041209
CURL_SETOPT(g_http_handle, CURLOPT_UPLOAD, 1);
12051210
CURL_SETOPT(g_http_handle, CURLOPT_READFUNCTION, http_readback);
12061211
CURL_SETOPT(g_http_handle, CURLOPT_READDATA, &si_read);
12071212
CURL_SETOPT(g_http_handle, CURLOPT_INFILESIZE, content_size);
12081213
}
1209-
else if (method == HTTP_UNKNOWN)
1210-
{
1211-
/* Assume the user knows what they are doing and pass unchanged */
1212-
CURL_SETOPT(g_http_handle, CURLOPT_CUSTOMREQUEST, method_str);
1213-
}
12141214
else
12151215
{
12161216
/* Never get here */

0 commit comments

Comments
 (0)