{"thread":{"id":"2046","subject":"[PATCH] Restore functionality to allow proxies to cache objects","startedAt":"2005-10-08T16:40:45Z","lastAt":"2005-10-08T18:45:46Z","messageCount":2,"participants":["Nick Hengeveld","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"9832","messageId":"20051008164045.GA8736@reactrix.com","threadId":"2046","inReplyTo":null,"subject":"[PATCH] Restore functionality to allow proxies to cache objects","fromName":"Nick Hengeveld","fromEmail":"nickh@reactrix.com","sentAt":"2005-10-08T16:40:45Z","receivedAt":"2005-10-08T16:40:45Z","isPatch":true,"sender":{"key":"nickh@reactrix.com","avatar":null},"body":"The parallel request changes didn't properly implement the previous patch to\nallow caching of retrieved objects by proxy servers.  Restore the previous\nfunctionality such that by default requests include the \"Pragma: no-cache\"\nheader, and this header is removed on requests for pack indexes, packs, and\nobjects.\n\nSigned-off-by: Nick Hengeveld <nickh@reactrix.com>\n\n\n---\n\nReading the revision history is useful...\n\n\n http-fetch.c |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\n6a9799a063e53764338d8c54b17464f46321ec60\ndiff --git a/http-fetch.c b/http-fetch.c\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -29,6 +29,7 @@ static int max_requests = DEFAULT_MAX_RE\n static CURLM *curlm;\n #endif\n static CURL *curl_default;\n+static struct curl_slist *pragma_header;\n static struct curl_slist *no_pragma_header;\n static struct curl_slist *no_range_header;\n static char curl_errorstr[CURL_ERROR_SIZE];\n@@ -203,7 +204,7 @@ struct active_request_slot *get_active_s\n \tslot->in_use = 1;\n \tslot->done = 0;\n \tslot->local = NULL;\n-\tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_pragma_header);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);\n \tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_range_header);\n \tcurl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, curl_errorstr);\n \n@@ -358,6 +359,7 @@ void start_request(struct transfer_reque\n \tcurl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);\n \tcurl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, request->errorstr);\n \tcurl_easy_setopt(slot->curl, CURLOPT_URL, url);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_pragma_header);\n \n \t/* If we have successfully processed data from a previous fetch\n \t   attempt, only fetch the data we don't already have. */\n@@ -568,6 +570,7 @@ static int fetch_index(struct alt_base *\n \tcurl_easy_setopt(slot->curl, CURLOPT_FILE, indexfile);\n \tcurl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite);\n \tcurl_easy_setopt(slot->curl, CURLOPT_URL, url);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_pragma_header);\n \tslot->local = indexfile;\n \n \t/* If there is data present from a previous transfer attempt,\n@@ -837,6 +840,7 @@ static int fetch_pack(struct alt_base *r\n \tcurl_easy_setopt(slot->curl, CURLOPT_FILE, packfile);\n \tcurl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite);\n \tcurl_easy_setopt(slot->curl, CURLOPT_URL, url);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_pragma_header);\n \tslot->local = packfile;\n \n \t/* If there is data present from a previous transfer attempt,\n@@ -1067,6 +1071,7 @@ int main(int argc, char **argv)\n \t\treturn 1;\n \t}\n #endif\n+\tpragma_header = curl_slist_append(pragma_header, \"Pragma: no-cache\");\n \tno_pragma_header = curl_slist_append(no_pragma_header, \"Pragma:\");\n \tno_range_header = curl_slist_append(no_range_header, \"Range:\");\n \n@@ -1106,6 +1111,7 @@ int main(int argc, char **argv)\n \tif (pull(commit_id))\n \t\treturn 1;\n \n+\tcurl_slist_free_all(pragma_header);\n \tcurl_slist_free_all(no_pragma_header);\n \tcurl_slist_free_all(no_range_header);\n \tcurl_easy_cleanup(curl_default);\n"},{"id":"9842","messageId":"7vmzljrgo5.fsf@assigned-by-dhcp.cox.net","threadId":"2046","inReplyTo":"20051008164045.GA8736@reactrix.com","subject":"Re: [PATCH] Restore functionality to allow proxies to cache objects","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-08T18:45:46Z","receivedAt":"2005-10-08T18:45:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nick Hengeveld <nickh@reactrix.com> writes:\n\n> Reading the revision history is useful...\n\nYes,  'git whatchanged' is quite powerful.\n"}]}