[Patch]: gwlib/http.c

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <45F8693B00AE49F3A80B9EE647E157A5@tardis>
Hi,

http_receive_result_real will free final_url if connection to server gets an error. There is no reason to do this, it is freed anyway in the calling program. final_url is part of the request, not the response that is invalid in this case and should be available to the calling program in case it needs to log it or whatever. Since this is a threaded/queued environment, it is not easy for the calling program to know that.

This patch will preserve it.

BR,
Nikos
http.diff (application/octet-stream, 787 B)
Index: gwlib/http.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/http.c,v
retrieving revision 1.262
diff -a -u -r1.262 http.c
--- gwlib/http.c	18 Jun 2009 07:25:59 -0000	1.262
+++ gwlib/http.c	13 Jan 2010 00:26:11 -0000
@@ -1769,17 +1769,16 @@
 
     request_id = trans->request_id;
     *status = trans->status;
+    *final_url = trans->url;
+    trans->url = NULL;
     
     if (trans->status >= 0) {
-        *final_url = trans->url;
         *headers = trans->response->headers;
         *body = trans->response->body;
 
-        trans->url = NULL;
         trans->response->headers = NULL;
         trans->response->body = NULL;
     } else {
-       *final_url = NULL;
        *headers = NULL;
        *body = NULL;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.