git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch for http-fetch.c and older curl releases
@ 2006-09-18 22:54 Art Haas
  2006-09-18 23:06 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Art Haas @ 2006-09-18 22:54 UTC (permalink / raw)
  To: git

Hi.

Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they
use CURLE_HTTP_NOT_FOUND instead. The trivial patch below fixes
the build error. Newer curl releases keep the CURLE_HTTP_NOT_FOUND
definition but using a -DCURL_NO_OLDIES preprocessor flag
the old name will not be present in the 'curl.h' header. The
comments in 'curl.h' have more info about the name change.

Signed-off-by:  Art Haas <ahaas@airmail.net>

diff --git a/http-fetch.c b/http-fetch.c
index bc74f30..76fcdc7 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -149,7 +149,7 @@ static int missing__target(int code, int
 	return	/* file:// URL -- do we ever use one??? */
 		(result == CURLE_FILE_COULDNT_READ_FILE) ||
 		/* http:// and https:// URL */
-		(code == 404 && result == CURLE_HTTP_RETURNED_ERROR) ||
+		(code == 404 && result == CURLE_HTTP_NOT_FOUND) ||
 		/* ftp:// URL */
 		(code == 550 && result == CURLE_FTP_COULDNT_RETR_FILE)
 		;

-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-18 22:54 Patch for http-fetch.c and older curl releases Art Haas
@ 2006-09-18 23:06 ` Junio C Hamano
  2006-09-18 23:57   ` Art Haas
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-09-18 23:06 UTC (permalink / raw)
  To: Art Haas; +Cc: git

"Art Haas" <ahaas@airmail.net> writes:

> Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they
> use CURLE_HTTP_NOT_FOUND instead. The trivial patch below fixes
> the build error. Newer curl releases keep the CURLE_HTTP_NOT_FOUND
> definition but using a -DCURL_NO_OLDIES preprocessor flag
> the old name will not be present in the 'curl.h' header. The
> comments in 'curl.h' have more info about the name change.
>
> Signed-off-by:  Art Haas <ahaas@airmail.net>

The patch to use older name in a recent program feels going
backwards.  The header is only trying to be nice so you can
compile old programs written for older interface that use older
names. If the new way is the primary way with the new interface,
and if we are writing a new program, I think we should write for
the new interface.

Can we have the main code to target the more recent version,
while working around problems with older versions with backward
compatibility macros?

In other words, if the macro HTTP_RETURNED_ERROR is not defined
in the header (i.e. older version), you define it to be the same
as HTTP_NOT_FOUND.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-18 23:06 ` Junio C Hamano
@ 2006-09-18 23:57   ` Art Haas
  2006-09-19  0:14     ` Junio C Hamano
  2006-09-19  8:31     ` Johannes Schindelin
  0 siblings, 2 replies; 8+ messages in thread
From: Art Haas @ 2006-09-18 23:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Mon, Sep 18, 2006 at 04:06:45PM -0700, Junio C Hamano wrote:
> "Art Haas" <ahaas@airmail.net> writes:
> 
> > Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they
> > use CURLE_HTTP_NOT_FOUND instead. The trivial patch below fixes
> > the build error. Newer curl releases keep the CURLE_HTTP_NOT_FOUND
> > definition but using a -DCURL_NO_OLDIES preprocessor flag
> > the old name will not be present in the 'curl.h' header. The
> > comments in 'curl.h' have more info about the name change.
> >
> > Signed-off-by:  Art Haas <ahaas@airmail.net>
> 
> The patch to use older name in a recent program feels going
> backwards.  The header is only trying to be nice so you can
> compile old programs written for older interface that use older
> names. If the new way is the primary way with the new interface,
> and if we are writing a new program, I think we should write for
> the new interface.
> 
> Can we have the main code to target the more recent version,
> while working around problems with older versions with backward
> compatibility macros?
> 
> In other words, if the macro HTTP_RETURNED_ERROR is not defined
> in the header (i.e. older version), you define it to be the same
> as HTTP_NOT_FOUND.
 
Hi.

Here's a patch that does that. I patched 'http.h' as there is already
a number of other curl tests in that file. On the machine where the 
build was failing, the 'curl-config --vernum' returned '070908',
and on my home machine where things build without issue the same
command returns '070f05', so I took that value to do the comparison.
Perhaps an intermediate value would work as well, but I don't have
a suitable version to check.

Signed-off-by:  Art Haas <ahaas@airmail.net>

diff --git a/http.h b/http.h
index 9ca16ac..aeff988 100644
--- a/http.h
+++ b/http.h
@@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04
 #define NO_CURL_EASY_DUPHANDLE
 #endif
 
+#if LIBCURL_VERSION_NUM < 0x070f05
+#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
+#endif
+
 struct slot_results
 {
 	CURLcode curl_result;

-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-18 23:57   ` Art Haas
@ 2006-09-19  0:14     ` Junio C Hamano
  2006-09-19  0:32       ` Art Haas
  2006-09-19  8:31     ` Johannes Schindelin
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-09-19  0:14 UTC (permalink / raw)
  To: Art Haas; +Cc: git

"Art Haas" <ahaas@airmail.net> writes:

> Here's a patch that does that. I patched 'http.h' as there is already
> a number of other curl tests in that file. On the machine where the 
> build was failing, the 'curl-config --vernum' returned '070908',
> and on my home machine where things build without issue the same
> command returns '070f05', so I took that value to do the comparison.
> Perhaps an intermediate value would work as well, but I don't have
> a suitable version to check.
>
> Signed-off-by:  Art Haas <ahaas@airmail.net>
>
> diff --git a/http.h b/http.h
> index 9ca16ac..aeff988 100644
> --- a/http.h
> +++ b/http.h
> @@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04
>  #define NO_CURL_EASY_DUPHANDLE
>  #endif
>  
> +#if LIBCURL_VERSION_NUM < 0x070f05
> +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
> +#endif
> +
>  struct slot_results
>  {
>  	CURLcode curl_result;
>

Eh, why not

        #ifndef CURLE_HTTP_RETURNED_ERROR
        #define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
        #endif

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-19  0:14     ` Junio C Hamano
@ 2006-09-19  0:32       ` Art Haas
  2006-09-19  0:37         ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Art Haas @ 2006-09-19  0:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Mon, Sep 18, 2006 at 05:14:42PM -0700, Junio C Hamano wrote:
> "Art Haas" <ahaas@airmail.net> writes:
> 
> > Here's a patch that does that. I patched 'http.h' as there is already
> > a number of other curl tests in that file. On the machine where the 
> > build was failing, the 'curl-config --vernum' returned '070908',
> > and on my home machine where things build without issue the same
> > command returns '070f05', so I took that value to do the comparison.
> > Perhaps an intermediate value would work as well, but I don't have
> > a suitable version to check.
> >
> > Signed-off-by:  Art Haas <ahaas@airmail.net>
> >
> > diff --git a/http.h b/http.h
> > index 9ca16ac..aeff988 100644
> > --- a/http.h
> > +++ b/http.h
> > @@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04
> >  #define NO_CURL_EASY_DUPHANDLE
> >  #endif
> >  
> > +#if LIBCURL_VERSION_NUM < 0x070f05
> > +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
> > +#endif
> > +
> >  struct slot_results
> >  {
> >  	CURLcode curl_result;
> >
> 
> Eh, why not
> 
>         #ifndef CURLE_HTTP_RETURNED_ERROR
>         #define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
>         #endif

Hi.

Both 'CURLE_HTTP_RETURNED_ERROR' and 'CURLE_HTTP_NOT_FOUND' are part of
an enumeration, not preprocessor '#define' values. I suppose that the
odd-looking 'E' in the names is meant to signify 'enum'.

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-19  0:32       ` Art Haas
@ 2006-09-19  0:37         ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2006-09-19  0:37 UTC (permalink / raw)
  To: git

"Art Haas" <ahaas@airmail.net> writes:

>> Eh, why not
>> 
>>         #ifndef CURLE_HTTP_RETURNED_ERROR
>>         #define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
>>         #endif
>
> Hi.
>
> Both 'CURLE_HTTP_RETURNED_ERROR' and 'CURLE_HTTP_NOT_FOUND' are part of
> an enumeration, not preprocessor '#define' values. I suppose that the
> odd-looking 'E' in the names is meant to signify 'enum'.

Ah, sorry I misunderstood the original problem completely.
Then your original patch is _much_ better.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-18 23:57   ` Art Haas
  2006-09-19  0:14     ` Junio C Hamano
@ 2006-09-19  8:31     ` Johannes Schindelin
  2006-09-19 12:20       ` Art Haas
  1 sibling, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2006-09-19  8:31 UTC (permalink / raw)
  To: Art Haas; +Cc: Junio C Hamano, git

Hi,

On Mon, 18 Sep 2006, Art Haas wrote:

> +#if LIBCURL_VERSION_NUM < 0x070f05
> +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
> +#endif

If you go to 

http://cool.haxx.se/cvs.cgi/curl/include/curl/curl.h?annotate=1.308

and search for HTTP_RETURNED_ERROR, it shows that revision "badger_1.180" 
introduced it, which you can verify by clicking on the link to the diff. 
This diff also says that the LIBCURL_VERSION_NUM (which is changed just 
after a release in the curl project) is 0x70a03. Thus, you should check 
for 0x70a03 instead of 0x70f05.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for http-fetch.c and older curl releases
  2006-09-19  8:31     ` Johannes Schindelin
@ 2006-09-19 12:20       ` Art Haas
  0 siblings, 0 replies; 8+ messages in thread
From: Art Haas @ 2006-09-19 12:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

On Tue, Sep 19, 2006 at 10:31:12AM +0200, Johannes Schindelin wrote:
> Hi,
> 
> On Mon, 18 Sep 2006, Art Haas wrote:
> 
> > +#if LIBCURL_VERSION_NUM < 0x070f05
> > +#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
> > +#endif
> 
> If you go to 
> 
> http://cool.haxx.se/cvs.cgi/curl/include/curl/curl.h?annotate=1.308
> 
> and search for HTTP_RETURNED_ERROR, it shows that revision "badger_1.180" 
> introduced it, which you can verify by clicking on the link to the diff. 
> This diff also says that the LIBCURL_VERSION_NUM (which is changed just 
> after a release in the curl project) is 0x70a03. Thus, you should check 
> for 0x70a03 instead of 0x70f05.

Hi.

Here's a patch that checks for that version of libcurl.

Signed-off-by: Art Haas <ahaas@airmail.net>

diff --git a/http.h b/http.h
index 9ca16ac..6e12e41 100644
--- a/http.h
+++ b/http.h
@@ -22,6 +22,10 @@ #if LIBCURL_VERSION_NUM < 0x070c04
 #define NO_CURL_EASY_DUPHANDLE
 #endif
 
+#if LIBCURL_VERSION_NUM < 0x070a03
+#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
+#endif
+
 struct slot_results
 {
 	CURLcode curl_result;

-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-09-19 12:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18 22:54 Patch for http-fetch.c and older curl releases Art Haas
2006-09-18 23:06 ` Junio C Hamano
2006-09-18 23:57   ` Art Haas
2006-09-19  0:14     ` Junio C Hamano
2006-09-19  0:32       ` Art Haas
2006-09-19  0:37         ` Junio C Hamano
2006-09-19  8:31     ` Johannes Schindelin
2006-09-19 12:20       ` Art Haas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).