Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: HTTP/2 stream 0 was not closed cleanly: #158

Closed
magick93 opened this issue Jun 15, 2023 · 3 comments
Closed

ERROR: HTTP/2 stream 0 was not closed cleanly: #158

magick93 opened this issue Jun 15, 2023 · 3 comments

Comments

@magick93
Copy link

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?

@pramsey
Copy link
Owner

pramsey commented Jun 15, 2023

Can you upgrade your underlying Curl library? This seems to be a resolved Curl issue curl/curl#3750

@magick93
Copy link
Author

This was due to a mistake in my data. I was passing in data that had two :.

@MathiasSchjoedt-Bavngaard

:

can you elaborate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants