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

SUPPORT unknown types #163

Merged
merged 2 commits into from
Aug 4, 2023
Merged

Conversation

robe2
Copy link
Contributor

@robe2 robe2 commented Aug 4, 2023

  • Define a new thing called HTTP_UNKNOWN
  • If doesn't fit our defined set of methods, mark as HTTP_UNKNOWN and pass the method type thru to curl unchanged
  • Get rid of http_method domain standard type enforcement

Closes #159

 - Define a new thing called HTTP_UNKNOWN
 - If doesn't fit our defined set of methods,
   mark as HTTP_UNKNOWN and pass the method type
   thru to curl unchanged
 - Get rid of http_method domain standard type
   enforcement

 Closes pramsey#159
http.c Outdated
@@ -1206,6 +1207,11 @@ Datum http_request(PG_FUNCTION_ARGS)
CURL_SETOPT(g_http_handle, CURLOPT_READDATA, &si_read);
CURL_SETOPT(g_http_handle, CURLOPT_INFILESIZE, content_size);
}
else if (method == HTTP_UNKNOWN)
{
/** assume the user knows what they are doing and pass unchanged **/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the double ** in the comment.

@@ -1078,8 +1079,8 @@ Datum http_request(PG_FUNCTION_ARGS)
elog(ERROR, "http_request.method is NULL");
method_str = TextDatumGetCString(values[REQ_METHOD]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry seeing this just in the patch w/o context, want to confirm we have a null check?

http.c Outdated
elog(DEBUG2, "pgsql-http: method '%s'", method_str);
pfree(method_str);
elog(DEBUG2, "pgsql-http: method_str '%s'", method_str);
elog(DEBUG2, "pgsql-http: method '%d'", method);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crunch it down to one debug line.

http.c Outdated
@@ -1225,7 +1231,12 @@ Datum http_request(PG_FUNCTION_ARGS)
/* If we had a content we do not reach that part */
elog(ERROR, "http_request.content is NULL");
}
else if ( method == HTTP_UNKNOWN ){
/** assume the user knows what they are doing and pass unchanged **/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/* this is fine */

@pramsey pramsey merged commit 3449283 into pramsey:master Aug 4, 2023
4 checks passed
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

Successfully merging this pull request may close these issues.

Violation check constraint "http_method_check" for request 'MKCOL'
2 participants