{"thread":{"id":"5602","subject":"Patch for http-fetch.c and older curl releases","startedAt":"2006-09-18T22:54:45Z","lastAt":"2006-09-19T12:20:19Z","messageCount":8,"participants":["Art Haas","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"27144","messageId":"20060918225445.GF1261@artsapartment.org","threadId":"5602","inReplyTo":null,"subject":"Patch for http-fetch.c and older curl releases","fromName":"Art Haas","fromEmail":"ahaas@airmail.net","sentAt":"2006-09-18T22:54:45Z","receivedAt":"2006-09-18T22:54:45Z","isPatch":false,"sender":{"key":"ahaas@airmail.net","avatar":null},"body":"Hi.\n\nOlder curl releases do not define CURLE_HTTP_RETURNED_ERROR, they\nuse CURLE_HTTP_NOT_FOUND instead. The trivial patch below fixes\nthe build error. Newer curl releases keep the CURLE_HTTP_NOT_FOUND\ndefinition but using a -DCURL_NO_OLDIES preprocessor flag\nthe old name will not be present in the 'curl.h' header. The\ncomments in 'curl.h' have more info about the name change.\n\nSigned-off-by:  Art Haas <ahaas@airmail.net>\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex bc74f30..76fcdc7 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -149,7 +149,7 @@ static int missing__target(int code, int\n \treturn\t/* file:// URL -- do we ever use one??? */\n \t\t(result == CURLE_FILE_COULDNT_READ_FILE) ||\n \t\t/* http:// and https:// URL */\n-\t\t(code == 404 && result == CURLE_HTTP_RETURNED_ERROR) ||\n+\t\t(code == 404 && result == CURLE_HTTP_NOT_FOUND) ||\n \t\t/* ftp:// URL */\n \t\t(code == 550 && result == CURLE_FTP_COULDNT_RETR_FILE)\n \t\t;\n\n-- \nMan once surrendering his reason, has no remaining guard against absurdities\nthe most monstrous, and like a ship without rudder, is the sport of every wind.\n\n-Thomas Jefferson to James Smith, 1822\n"},{"id":"27145","messageId":"7v4pv4pyey.fsf@assigned-by-dhcp.cox.net","threadId":"5602","inReplyTo":"20060918225445.GF1261@artsapartment.org","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-18T23:06:45Z","receivedAt":"2006-09-18T23:06:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Art Haas\" <ahaas@airmail.net> writes:\n\n> Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they\n> use CURLE_HTTP_NOT_FOUND instead. The trivial patch below fixes\n> the build error. Newer curl releases keep the CURLE_HTTP_NOT_FOUND\n> definition but using a -DCURL_NO_OLDIES preprocessor flag\n> the old name will not be present in the 'curl.h' header. The\n> comments in 'curl.h' have more info about the name change.\n>\n> Signed-off-by:  Art Haas <ahaas@airmail.net>\n\nThe patch to use older name in a recent program feels going\nbackwards.  The header is only trying to be nice so you can\ncompile old programs written for older interface that use older\nnames. If the new way is the primary way with the new interface,\nand if we are writing a new program, I think we should write for\nthe new interface.\n\nCan we have the main code to target the more recent version,\nwhile working around problems with older versions with backward\ncompatibility macros?\n\nIn other words, if the macro HTTP_RETURNED_ERROR is not defined\nin the header (i.e. older version), you define it to be the same\nas HTTP_NOT_FOUND.\n"},{"id":"27146","messageId":"20060918235753.GG1261@artsapartment.org","threadId":"5602","inReplyTo":"7v4pv4pyey.fsf@assigned-by-dhcp.cox.net","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Art Haas","fromEmail":"ahaas@airmail.net","sentAt":"2006-09-18T23:57:53Z","receivedAt":"2006-09-18T23:57:53Z","isPatch":false,"sender":{"key":"ahaas@airmail.net","avatar":null},"body":"On Mon, Sep 18, 2006 at 04:06:45PM -0700, Junio C Hamano wrote:\n> \"Art Haas\" <ahaas@airmail.net> writes:\n> \n> > Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they\n> > use CURLE_HTTP_NOT_FOUND instead. The trivial patch below fixes\n> > the build error. Newer curl releases keep the CURLE_HTTP_NOT_FOUND\n> > definition but using a -DCURL_NO_OLDIES preprocessor flag\n> > the old name will not be present in the 'curl.h' header. The\n> > comments in 'curl.h' have more info about the name change.\n> >\n> > Signed-off-by:  Art Haas <ahaas@airmail.net>\n> \n> The patch to use older name in a recent program feels going\n> backwards.  The header is only trying to be nice so you can\n> compile old programs written for older interface that use older\n> names. If the new way is the primary way with the new interface,\n> and if we are writing a new program, I think we should write for\n> the new interface.\n> \n> Can we have the main code to target the more recent version,\n> while working around problems with older versions with backward\n> compatibility macros?\n> \n> In other words, if the macro HTTP_RETURNED_ERROR is not defined\n> in the header (i.e. older version), you define it to be the same\n> as HTTP_NOT_FOUND.\n \nHi.\n\nHere's a patch that does that. I patched 'http.h' as there is already\na number of other curl tests in that file. On the machine where the \nbuild was failing, the 'curl-config --vernum' returned '070908',\nand on my home machine where things build without issue the same\ncommand returns '070f05', so I took that value to do the comparison.\nPerhaps an intermediate value would work as well, but I don't have\na suitable version to check.\n\nSigned-off-by:  Art Haas <ahaas@airmail.net>\n\ndiff --git a/http.h b/http.h\nindex 9ca16ac..aeff988 100644\n--- a/http.h\n+++ b/http.h\n@@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04\n #define NO_CURL_EASY_DUPHANDLE\n #endif\n \n+#if LIBCURL_VERSION_NUM < 0x070f05\n+#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n+#endif\n+\n struct slot_results\n {\n \tCURLcode curl_result;\n\n-- \nMan once surrendering his reason, has no remaining guard against absurdities\nthe most monstrous, and like a ship without rudder, is the sport of every wind.\n\n-Thomas Jefferson to James Smith, 1822\n"},{"id":"27147","messageId":"7vzmcwogp9.fsf@assigned-by-dhcp.cox.net","threadId":"5602","inReplyTo":"20060918235753.GG1261@artsapartment.org","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-19T00:14:42Z","receivedAt":"2006-09-19T00:14:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Art Haas\" <ahaas@airmail.net> writes:\n\n> Here's a patch that does that. I patched 'http.h' as there is already\n> a number of other curl tests in that file. On the machine where the \n> build was failing, the 'curl-config --vernum' returned '070908',\n> and on my home machine where things build without issue the same\n> command returns '070f05', so I took that value to do the comparison.\n> Perhaps an intermediate value would work as well, but I don't have\n> a suitable version to check.\n>\n> Signed-off-by:  Art Haas <ahaas@airmail.net>\n>\n> diff --git a/http.h b/http.h\n> index 9ca16ac..aeff988 100644\n> --- a/http.h\n> +++ b/http.h\n> @@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04\n>  #define NO_CURL_EASY_DUPHANDLE\n>  #endif\n>  \n> +#if LIBCURL_VERSION_NUM < 0x070f05\n> +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n> +#endif\n> +\n>  struct slot_results\n>  {\n>  \tCURLcode curl_result;\n>\n\nEh, why not\n\n        #ifndef CURLE_HTTP_RETURNED_ERROR\n        #define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n        #endif\n"},{"id":"27148","messageId":"20060919003237.GH1261@artsapartment.org","threadId":"5602","inReplyTo":"7vzmcwogp9.fsf@assigned-by-dhcp.cox.net","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Art Haas","fromEmail":"ahaas@airmail.net","sentAt":"2006-09-19T00:32:37Z","receivedAt":"2006-09-19T00:32:37Z","isPatch":false,"sender":{"key":"ahaas@airmail.net","avatar":null},"body":"On Mon, Sep 18, 2006 at 05:14:42PM -0700, Junio C Hamano wrote:\n> \"Art Haas\" <ahaas@airmail.net> writes:\n> \n> > Here's a patch that does that. I patched 'http.h' as there is already\n> > a number of other curl tests in that file. On the machine where the \n> > build was failing, the 'curl-config --vernum' returned '070908',\n> > and on my home machine where things build without issue the same\n> > command returns '070f05', so I took that value to do the comparison.\n> > Perhaps an intermediate value would work as well, but I don't have\n> > a suitable version to check.\n> >\n> > Signed-off-by:  Art Haas <ahaas@airmail.net>\n> >\n> > diff --git a/http.h b/http.h\n> > index 9ca16ac..aeff988 100644\n> > --- a/http.h\n> > +++ b/http.h\n> > @@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04\n> >  #define NO_CURL_EASY_DUPHANDLE\n> >  #endif\n> >  \n> > +#if LIBCURL_VERSION_NUM < 0x070f05\n> > +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n> > +#endif\n> > +\n> >  struct slot_results\n> >  {\n> >  \tCURLcode curl_result;\n> >\n> \n> Eh, why not\n> \n>         #ifndef CURLE_HTTP_RETURNED_ERROR\n>         #define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n>         #endif\n\nHi.\n\nBoth 'CURLE_HTTP_RETURNED_ERROR' and 'CURLE_HTTP_NOT_FOUND' are part of\nan enumeration, not preprocessor '#define' values. I suppose that the\nodd-looking 'E' in the names is meant to signify 'enum'.\n\nArt Haas\n-- \nMan once surrendering his reason, has no remaining guard against absurdities\nthe most monstrous, and like a ship without rudder, is the sport of every wind.\n\n-Thomas Jefferson to James Smith, 1822\n"},{"id":"27149","messageId":"7vvenkofmv.fsf@assigned-by-dhcp.cox.net","threadId":"5602","inReplyTo":"20060919003237.GH1261@artsapartment.org","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-19T00:37:44Z","receivedAt":"2006-09-19T00:37:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Art Haas\" <ahaas@airmail.net> writes:\n\n>> Eh, why not\n>> \n>>         #ifndef CURLE_HTTP_RETURNED_ERROR\n>>         #define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n>>         #endif\n>\n> Hi.\n>\n> Both 'CURLE_HTTP_RETURNED_ERROR' and 'CURLE_HTTP_NOT_FOUND' are part of\n> an enumeration, not preprocessor '#define' values. I suppose that the\n> odd-looking 'E' in the names is meant to signify 'enum'.\n\nAh, sorry I misunderstood the original problem completely.\nThen your original patch is _much_ better.\n"},{"id":"27152","messageId":"Pine.LNX.4.63.0609191027020.19042@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5602","inReplyTo":"20060918235753.GG1261@artsapartment.org","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-09-19T08:31:12Z","receivedAt":"2006-09-19T08:31:12Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 18 Sep 2006, Art Haas wrote:\n\n> +#if LIBCURL_VERSION_NUM < 0x070f05\n> +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n> +#endif\n\nIf you go to \n\nhttp://cool.haxx.se/cvs.cgi/curl/include/curl/curl.h?annotate=1.308\n\nand search for HTTP_RETURNED_ERROR, it shows that revision \"badger_1.180\" \nintroduced it, which you can verify by clicking on the link to the diff. \nThis diff also says that the LIBCURL_VERSION_NUM (which is changed just \nafter a release in the curl project) is 0x70a03. Thus, you should check \nfor 0x70a03 instead of 0x70f05.\n\nCiao,\nDscho\n"},{"id":"27156","messageId":"20060919122019.GA14835@artsapartment.org","threadId":"5602","inReplyTo":"Pine.LNX.4.63.0609191027020.19042@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Patch for http-fetch.c and older curl releases","fromName":"Art Haas","fromEmail":"ahaas@airmail.net","sentAt":"2006-09-19T12:20:19Z","receivedAt":"2006-09-19T12:20:19Z","isPatch":false,"sender":{"key":"ahaas@airmail.net","avatar":null},"body":"On Tue, Sep 19, 2006 at 10:31:12AM +0200, Johannes Schindelin wrote:\n> Hi,\n> \n> On Mon, 18 Sep 2006, Art Haas wrote:\n> \n> > +#if LIBCURL_VERSION_NUM < 0x070f05\n> > +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n> > +#endif\n> \n> If you go to \n> \n> http://cool.haxx.se/cvs.cgi/curl/include/curl/curl.h?annotate=1.308\n> \n> and search for HTTP_RETURNED_ERROR, it shows that revision \"badger_1.180\" \n> introduced it, which you can verify by clicking on the link to the diff. \n> This diff also says that the LIBCURL_VERSION_NUM (which is changed just \n> after a release in the curl project) is 0x70a03. Thus, you should check \n> for 0x70a03 instead of 0x70f05.\n\nHi.\n\nHere's a patch that checks for that version of libcurl.\n\nSigned-off-by: Art Haas <ahaas@airmail.net>\n\ndiff --git a/http.h b/http.h\nindex 9ca16ac..6e12e41 100644\n--- a/http.h\n+++ b/http.h\n@@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04\n #define NO_CURL_EASY_DUPHANDLE\n #endif\n \n+#if LIBCURL_VERSION_NUM < 0x070a03\n+#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND\n+#endif\n+\n struct slot_results\n {\n \tCURLcode curl_result;\n\n-- \nMan once surrendering his reason, has no remaining guard against absurdities\nthe most monstrous, and like a ship without rudder, is the sport of every wind.\n\n-Thomas Jefferson to James Smith, 1822\n"}]}