r3327 dsilvers - in /branches/dsilvers/scheme-switcher: content/fetch.c content/fetchers/fetch_curl.h makefile utils/useragent.c

netsurf at semichrome.net netsurf at semichrome.net
Sun Jun 10 16:54:44 BST 2007


Author: dsilvers
Date: Sun Jun 10 16:54:43 2007
New Revision: 3327

URL: http://svn.semichrome.net?rev=3D3327&view=3Drev
Log:
More cleanups, and add missing header

Added:
    branches/dsilvers/scheme-switcher/content/fetchers/fetch_curl.h
Modified:
    branches/dsilvers/scheme-switcher/content/fetch.c
    branches/dsilvers/scheme-switcher/makefile
    branches/dsilvers/scheme-switcher/utils/useragent.c

Modified: branches/dsilvers/scheme-switcher/content/fetch.c
URL: http://svn.semichrome.net/branches/dsilvers/scheme-switcher/content/fe=
tch.c?rev=3D3327&r1=3D3326&r2=3D3327&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/dsilvers/scheme-switcher/content/fetch.c (original)
+++ branches/dsilvers/scheme-switcher/content/fetch.c Sun Jun 10 16:54:43 2=
007
@@ -24,7 +24,6 @@
 #include <time.h>
 #include <sys/select.h>
 #include <sys/stat.h>
-#include <sys/utsname.h>
 #ifdef riscos
 #include <unixlib/local.h>
 #endif
@@ -400,58 +399,28 @@
 	return fetch->referer;
 }
 =

-/**
- * testing framework
- */
-
-#ifdef TEST
-#include <unistd.h>
-
-struct test {char *url; struct fetch *f;};
-
-void callback(fetch_msg msg, struct test *t, char *data, unsigned long siz=
e)
-{
-	printf("%s: ", t->url);
-	switch (msg) {
-		case FETCH_TYPE:
-			printf("FETCH_TYPE '%s'", data);
-			break;
-		case FETCH_DATA:
-			printf("FETCH_DATA %lu", size);
-			break;
-		case FETCH_FINISHED:
-			printf("FETCH_FINISHED");
-			break;
-		case FETCH_ERROR:
-			printf("FETCH_ERROR '%s'", data);
-			break;
-		default:
-			assert(0);
-	}
-	printf("\n");
-}
-
-struct test test[] =3D {
-	{"http://127.0.0.1/", 0},
-	{"http://netsurf.strcprstskrzkrk.co.uk/", 0},
-	{"http://www.oxfordstudent.com/", 0},
-	{"http://www.google.co.uk/", 0},
-	{"http://news.bbc.co.uk/", 0},
-	{"http://doesnt.exist/", 0},
-	{"blah://blah", 0},
-};
-
-int main(void)
-{
-	int i;
-	fetch_init();
-	for (i =3D 0; i !=3D sizeof(test) / sizeof(test[0]); i++)
-		test[i].f =3D fetch_start(test[i].url, 0, callback, &test[i]);
-	while (1) {
-		fetch_poll();
-		sleep(1);
-	}
-	return 0;
-}
-#endif
-
+void
+fetch_send_callback(fetch_msg msg, struct fetch *fetch, void *data, unsign=
ed long size)
+{
+        fetch->callback(msg, fetch->p, data, size);
+}
+
+void
+fetch_can_be_freed(struct fetch *fetch)
+{
+        /* Go ahead and free the fetch properly now */
+}
+
+void
+fetch_set_http_code(struct fetch *fetch, long http_code)
+{
+        fetch->http_code =3D http_code;
+}
+
+const char *
+fetch_get_referer_to_send(struct fetch *fetch)
+{
+        if (fetch->send_referer)
+                return fetch->referer;
+        return NULL;
+}

Added: branches/dsilvers/scheme-switcher/content/fetchers/fetch_curl.h
URL: http://svn.semichrome.net/branches/dsilvers/scheme-switcher/content/fe=
tchers/fetch_curl.h?rev=3D3327&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/dsilvers/scheme-switcher/content/fetchers/fetch_curl.h (added)
+++ branches/dsilvers/scheme-switcher/content/fetchers/fetch_curl.h Sun Jun=
 10 16:54:43 2007
@@ -1,0 +1,22 @@
+/*
+ * This file is part of NetSurf, http://netsurf-browser.org/
+ * Licensed under the GNU General Public License,
+ *		  http://www.opensource.org/licenses/gpl-license
+ * Copyright 2007 Daniel Silverstone <dsilvers at digital-scurf.org>
+ */
+
+/** \file
+ * Fetching of data from a URL (Registration).
+ */
+
+#ifndef NETSURF_CONTENT_FETCHERS_FETCH_CURL_H
+#define NETSURF_CONTENT_FETCHERS_FETCH_CURL_H
+
+#include <curl/curl.h>
+
+void register_curl_fetchers(void);
+
+/** Global cURL multi handle. */
+extern CURLM *fetch_curl_multi;
+
+#endif

Modified: branches/dsilvers/scheme-switcher/makefile
URL: http://svn.semichrome.net/branches/dsilvers/scheme-switcher/makefile?r=
ev=3D3327&r1=3D3326&r2=3D3327&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/dsilvers/scheme-switcher/makefile (original)
+++ branches/dsilvers/scheme-switcher/makefile Sun Jun 10 16:54:43 2007
@@ -26,7 +26,7 @@
 	form.o html.o html_redraw.o imagemap.o layout.o list.o \
 	table.o textplain.o					# render/
 OBJECTS_COMMON +=3D filename.o hashtable.o messages.o talloc.o \
-	url.o utf8.o utils.o					# utils/
+	url.o utf8.o utils.o useragent.o			# utils/
 OBJECTS_COMMON +=3D knockout.o options.o tree.o version.o		# desktop/
 =

 OBJECTS_IMAGE =3D bmp.o bmpread.o gif.o gifread.o ico.o jpeg.o \
@@ -210,7 +210,7 @@
 # available), remove */*.[ch] from the line below.
 # Under RISC OS, you may require *Set UnixFS$sfix "", if perl gives
 # "No such file or directory" errors.
-depend: css/css_enum.c css/parser.c css/scanner.c utils/translit.c */*.[ch]
+depend: css/css_enum.c css/parser.c css/scanner.c utils/translit.c */*.[ch=
] */*/*.[ch]
 	@echo "--> modified files $?"
 	@echo "--> updating dependencies"
 	@-mkdir -p $(OBJDIR_RISCOS) $(OBJDIR_RISCOS_SMALL) $(OBJDIR_NCOS) $(OBJDI=
R_DEBUG) $(OBJDIR_GTK)

Modified: branches/dsilvers/scheme-switcher/utils/useragent.c
URL: http://svn.semichrome.net/branches/dsilvers/scheme-switcher/utils/user=
agent.c?rev=3D3327&r1=3D3326&r2=3D3327&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/dsilvers/scheme-switcher/utils/useragent.c (original)
+++ branches/dsilvers/scheme-switcher/utils/useragent.c Sun Jun 10 16:54:43=
 2007
@@ -5,6 +5,13 @@
  * Copyright 2007 Daniel Silverstone <dsilvers at digital-scurf.org>
  * Copyright 2007 Rob Kendrick <rjek at netsurf-browser.org>
  */
+
+#include <sys/utsname.h>
+#include <stdio.h>
+
+#include "useragent.h"
+#include "desktop/netsurf.h"
+#include "utils/log.h"
 =

 static const char *core_user_agent_string =3D NULL;
 =

@@ -40,7 +47,7 @@
            un.sysname,
            un.machine);
 =

-  LOG(("fetch_user_agent \"%s\"", fetch_user_agent));
+  LOG(("Built user agent \"%s\"", core_user_agent_string));
 }
 =

 /* This is a function so that later we can override it trivially */





More information about the netsurf-commits mailing list