-
Notifications
You must be signed in to change notification settings - Fork 102
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
Components with control characters don't appear in --json
output, and non-urlencoded --get
fails
#262
Comments
Something interesting I noticed is that is works for queries. I wonder if we're missing a memdupdec somewhere? I'd bet I broke this in this PR #214 but maybe it's been broken the whole time. |
This looks like it's behavior from libcurl. I was able to get the same result with the following code. Should we open a ticked over there or are we just overlooking something simple? #include <curl/curl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
CURL *curl;
CURLU *url;
CURLUcode uc;
// do it how trurl does it
char *array= calloc(32, sizeof(char));
const char *url_string = "http://example.org/%18";
curl = curl_easy_init();
url = curl_url();
uc = curl_url_set(url, CURLUPART_URL, url_string, 0);
uc = curl_url_get(url, CURLUPART_PATH, &array, CURLU_URLDECODE);
if(uc) {
printf("%s\n", curl_url_strerror(uc));
} else {
printf("%s\n", array);
}
// try with curl easy unescape
int decode_len;
char *decoded = curl_easy_unescape(curl, url_string, strlen(url_string), &decode_len);
printf("%s\n", decoded);
printf("length: %ld, amount decoded: %d\n", strlen(url_string), decode_len);
curl_url_cleanup(url);
curl_easy_cleanup(curl);
free(array);
return 0;
} |
Ahh it could also be that
After some more testing I think you are just supposed to pass
|
For example when doing trurl 'http://example.org/%18' --json Adapted and extended test cases to verify. Fixes #262 Reported-by: Emanuele Torre
The text was updated successfully, but these errors were encountered: