Closed
Description
Hello
I'm trying to make a POST
request, but I'm getting an odd error back. The error is SQL Error [XX000]: ERROR: Error in the HTTP2 framing layer
.
The code I'm using is:
post_data := 'from=example.com<' || urlencode (message->>'sender') || '>' ||
'&to=' || urlencode (message->>'recipient') ||
-- CASE WHEN message->>'cc' IS NOT NULL THEN '&cc=' || urlencode(message->>'cc') ELSE '' END ||
-- CASE WHEN message->>'bcc' IS NOT NULL THEN '&bcc=' || urlencode(message->>'bcc') ELSE '' END ||
-- CASE WHEN message->>'messageid' IS NOT NULL THEN '&v:messageid=' || urlencode(message->>'messageid') ELSE '' END ||
'&subject=' || urlencode(message->>'subject') ||
-- '&h:X-Mailgun-Variables=' || urlencode(message->>'payload') ||
'&template=' || urlencode(message->>'template');
RAISE NOTICE 'Post Data: %', post_data;
PERFORM http_set_curlopt('--http1.1', null);
-- raise notice 'curl opts: %', http_list_curlopt();
-- SELECT content INTO retval
-- FROM http(('POST',
-- mailgun_message_url,
-- ARRAY[
-- http_header ('Authorization', 'Basic ' || encode(concat('api:', MAILGUN_API_KEY)::bytea, 'base64'::text))
-- ],
-- 'application/json',
-- post_data));
SELECT content INTO retval
FROM http(('POST',
mailgun_message_url,
ARRAY[
http_header ('Authorization', 'Basic ' || encode(concat('api:', MAILGUN_API_KEY)::bytea, 'base64'::text))
],
'application/x-www-form-urlencoded',
post_data));
RAISE NOTICE 'Mailgun Response: %', retval;
This may be due to the remote server requiring HTTP 1.1. Is it possible to tell curl to use HTTP 1.1 from pgsql-http?
Metadata
Metadata
Assignees
Labels
No labels