Re: [gnet-dev] GConnHttp change
- From: "Samuel Cormier-Iijima" <sciyoshi gmail com>
- To: "cascardo minaslivre org" <cascardo minaslivre org>
- Cc: gnet-dev lists gnetlibrary org
- Subject: Re: [gnet-dev] GConnHttp change
- Date: Sun, 29 Oct 2006 09:30:43 -0500
OK, updated patch attached. New function is
gnet_conn_http_set_uri_unescaped, make check passes.
Samuel Cormier-iijima
On 10/29/06, cascardo minaslivre org <cascardo minaslivre org> wrote:
On Sun, Oct 29, 2006 at 01:50:33AM -0500, Samuel Cormier-Iijima wrote:
> Hi again,
>
> For the BitTorrent client I'm writing, I need to create a GConnHttp
> whose URL might include embedded NULLs. The thing is, the current
> gnet_conn_http_new accepts an unencoded URL which it then escapes for
> me. This patch changes the behavior so that it won't automatically
> escapes; it's required for my program but might break other
> functionality (which would then require users to escape the URL
> themselves.) Could this possibly be included? Thanks alot,
>
> Samuel
Hi, Samuel.
Since, as you said, it might break some other applications, perhaps, you
should write a new function gnet_conn_http_new_unescaped. Since it
would be very similar to gnet_conn_http_new, you should write an internal
function that would do what both functions have in common and use it in
both.
Regards,
Thadeu Cascardo.
_______________________________________________
gnet-dev mailing list
gnet-dev lists gnetlibrary org
http://lists.gnetlibrary.org/mailman/listinfo/gnet-dev
Index: src/conn-http.c
===================================================================
RCS file: /cvs/gnome/gnet/src/conn-http.c,v
retrieving revision 1.10
diff -u -r1.10 conn-http.c
--- src/conn-http.c 5 May 2006 16:13:51 -0000 1.10
+++ src/conn-http.c 29 Oct 2006 14:28:56 -0000
@@ -497,14 +497,36 @@
* @conn: a #GConnHttp
* @uri: URI string
*
- * Sets the URI to GET or POST, e.g. http://www.google.com
+ * Sets the URI of the connection, escaping invalid characters if necessary.
+ * Returns: TRUE if the URI was accepted
+ **/
+
+gboolean
+gnet_conn_http_set_uri (GConnHttp *conn, const gchar *uri)
+{
+ if (!gnet_conn_http_set_uri_unescaped (conn, uri))
+ return FALSE;
+
+ gnet_uri_escape (conn->uri);
+
+ return TRUE;
+}
+
+
+/**
+ * gnet_conn_http_set_uri_unescaped
+ * @conn: a #GConnHttp
+ * @uri: URI string
+ *
+ * Sets the URI to GET or POST, e.g. http://www.google.com. It will not be
+ * escaped; the caller is expected to escape the URI itself.
*
* Returns: TRUE if the URI has been accepted.
*
**/
gboolean
-gnet_conn_http_set_uri (GConnHttp *conn, const gchar *uri)
+gnet_conn_http_set_uri_unescaped (GConnHttp *conn, const gchar *uri)
{
gchar *old_hostname = NULL;
@@ -554,8 +576,6 @@
return FALSE;
gnet_uri_set_scheme(conn->uri, "http");
-
- gnet_uri_escape(conn->uri);
return TRUE;
}
Index: src/conn-http.h
===================================================================
RCS file: /cvs/gnome/gnet/src/conn-http.h,v
retrieving revision 1.4
diff -u -r1.4 conn-http.h
--- src/conn-http.h 25 Apr 2005 10:30:36 -0000 1.4
+++ src/conn-http.h 29 Oct 2006 14:28:56 -0000
@@ -343,6 +343,9 @@
gboolean gnet_conn_http_set_uri (GConnHttp *conn,
const gchar *uri);
+gboolean gnet_conn_http_set_uri_unescaped (GConnHttp *conn,
+ const gchar *uri);
+
gboolean gnet_conn_http_set_header (GConnHttp *conn,
const gchar *field,
const gchar *value,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]