Client: if have a non-English language, set ACCEPT_LANGUAGE in all HTTP requests

This commit is contained in:
David Anderson 2013-12-11 00:35:03 -08:00
parent 557cbab937
commit 0276ea6a2a
2 changed files with 9 additions and 12 deletions

View File

@ -719,14 +719,6 @@ RSS_FEED_OP::RSS_FEED_OP() {
gui_http = &gstate.gui_http;
}
static void append_language(char* in, char* out) {
if (strstr(in, "?")) {
sprintf(out, "%s&lang=%s", in, gstate.language);
} else {
sprintf(out, "%s?lang=%s", in, gstate.language);
}
}
// see if time to start new fetch
//
bool RSS_FEED_OP::poll() {
@ -746,7 +738,7 @@ bool RSS_FEED_OP::poll() {
);
}
char url[1024];
append_language(rf.url, url);
strcpy(url, rf.url);
gstate.gui_http.do_rpc(this, url, filename, true);
break;
}

View File

@ -409,7 +409,7 @@ int HTTP_OP::libcurl_exec(
bool is_post
) {
CURLMcode curlMErr;
char strTmp[128];
char buf[256];
static int outfile_seqno=0;
safe_strcpy(m_url, url);
@ -591,12 +591,17 @@ int HTTP_OP::libcurl_exec(
//
pcurlList = curl_slist_append(pcurlList, g_content_type);
if (strlen(gstate.language)) {
sprintf(buf, "ACCEPT_LANGUAGE: %s", gstate.language);
pcurlList = curl_slist_append(pcurlList, buf);
}
// set the file offset for resumable downloads
//
if (!is_post && offset>0.0f) {
file_offset = offset;
sprintf(strTmp, "Range: bytes=%.0f-", offset);
pcurlList = curl_slist_append(pcurlList, strTmp);
sprintf(buf, "Range: bytes=%.0f-", offset);
pcurlList = curl_slist_append(pcurlList, buf);
}
// set up an output file for the reply