Like makeHTTPGETCall(), but the list of options will be concatenated to * the URL as a query string, and URL encoded as needed. * The option list array should contain optnum*2 strings, alternating * option names and values. */
| 299 | * The option list array should contain optnum*2 strings, alternating |
| 300 | * option names and values. */ |
| 301 | sds makeHTTPGETCallOpt(const char *url, int *resptr, char **optlist, int optnum) { |
| 302 | sds fullurl = sdsnew(url); |
| 303 | if (optnum) fullurl = sdscatlen(fullurl,"?",1); |
| 304 | CURL *curl = curl_easy_init(); |
| 305 | for (int j = 0; j < optnum; j++) { |
| 306 | if (j > 0) fullurl = sdscatlen(fullurl,"&",1); |
| 307 | fullurl = sdscat(fullurl,optlist[j*2]); |
| 308 | fullurl = sdscatlen(fullurl,"=",1); |
| 309 | char *escaped = curl_easy_escape(curl, |
| 310 | optlist[j*2+1],strlen(optlist[j*2+1])); |
| 311 | fullurl = sdscat(fullurl,escaped); |
| 312 | curl_free(escaped); |
| 313 | } |
| 314 | curl_easy_cleanup(curl); |
| 315 | sds body = makeHTTPGETCall(fullurl,resptr); |
| 316 | sdsfree(fullurl); |
| 317 | return body; |
| 318 | } |
| 319 | |
| 320 | /* Make an HTTP request to the Telegram bot API, where 'req' is the specified |
| 321 | * action name. This is a low level API that is used by other bot APIs |
no test coverage detected