Embeddable web view in apps
by Richard Gale
It seems like netsurf is a great candidate for providing HTML based UI in apps. Is this something anyone has tried from a technical point of view?
Does the current licensing support this for paid for apps or is netsurf licensable for such purposes?
Thanks,Richard.
9 years
IDNA2008 - take 2
by Chris Young
OK, second attempt at international domain name support.
Branch: chris/idna2008
I've had to import some unrestricted code from elsewhere, due to the
necessity of Unicode normalisation and other things. It is working
and conforming to the spec, as far as I read it.
A couple of minor issues/todos:
1. If an invalid URL is encountered during page layout/box conversion,
NetSurf gives a BoxConvert warning and the page is never displayed.
This is caused by my new code making nsurl_create return
NSERROR_BAD_URL when an IDN fails the compliance checks.
I've not been able to work out where in the core this error code is
terminating page layout.
Page showing this problem:
http://blogs.msdn.com/b/shawnste/archive/2006/09/14/idn-test-urls.aspx
2. If a frontend wants to display the UTF-8 version of an IDN then
currently the URL needs stripping into component parts, the host run
through idna_decode() and the whole thing put back together again.
This should probably be handled by nsurl but I'm not sure of the best
way to implement it.
3. There are some to-dos noted in code comments for further compliance
checking. They are optional in the spec, and I don't see any need to
implement them - anything invalid will be rejected by DNS. Most of
the mandatory checks seem overkill anyway, given that there is
stricter checking at DNS registration time.
I have included the optional decode-reencode check for already encoded
addresses to weed out any undecodeable nonsense the user might have
typed in, but it doesn't bother to do normalisation or validity
checking of the decoded address before re-encoding it (maybe it
should, I'm not sure, the spec was vague on this point).
Chris
9 years, 5 months
HTTP 2.0
by Chris Young
I've just put a small patch in branch chris/http2 to enable libcurl to
use HTTP 2.0 if it is the latest version.
libcurl also needs building against nghttp2 for this to do anything
(there is an equivalent patch in the toolchains chris/http2 branch)
As it is still in draft I've put an option in to enable it, rather
than it being enabled by default. Certainly Google's server - if not
connecting over https - returns an error. Over https it works fine
(and appears to have negotiated http2 to some extent), so I think it's
probably just not up-to-date with the latest spec.
I'll temporarily add myself to the curl mailing list and ask about
that.
Anyway, it's there for testing, merging, criticising, whatever.
Chris
9 years, 6 months
Question about parserutils_buffer_discard
by Elie Roudninski
Hi everyone,
I have a question about the function parserutils_buffer_discard.
As i understand, it is meant to "discard" some data from the buffer :
---------------------------------------------------------------
| |xxxx| |
| |xxxx| |
|---------------------------------------------------------------
s--------------------------------o-------l------------------->
s being start, o offset, and length, the amount of bytes to disard.
The memmove being done is :
memmove(buffer->data + offset, buffer->data + offset + len, buffer->length
- len);
I wonder why you would move more data than what's left in the buffer ?
As i understand the situation, there is buffer->length-(offset+len) bytes
left, my question is, why not do this :
memmove(buffer->data + offset, buffer->data + offset + len, buffer->length
- (offset + len));
Thanks in advance for your responses,
Regards,
adema
9 years, 8 months
[PATCH] Encode non-ASCII hosts according to IDNA2008
by Chris Young
This is my attempt at adding IDNA2008 support. It is in branch
chris/idn-punycode (this is a condensed version but same as HEAD
there).
I've used libidn2 because it fully conforms to the spec, although I
can see there may be a benefit to not using an external library for
this. libidn2 seems to build cleanly with no patches on OS4 so I
don't envisage any major problems elsewhere, however I've made it
optional for now.
As I've put it in nsurl_create the non-ASCII hosts are automatically
handled everywhere in NetSurf, and are passed back to the frontend as
the punycode version so there should be no weird problems with
frontend string gadgets not supporting UTF-8.
I've tested the Amiga and GTK frontends and things like www.bücher.de
are handled correctly when typed in or clicked. Other frontends may
need to ensure any URLs typed in are passed as UTF-8.
---
Makefile.defaults | 4 ++++
amiga/Makefile.target | 2 ++
gtk/Makefile.target | 3 ++-
utils/nsurl.c | 25 ++++++++++++++++++++++---
4 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/Makefile.defaults b/Makefile.defaults
index e11fa1f..72374db 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -67,6 +67,10 @@ NETSURF_USE_MOZJS := AUTO
# Valid options: YES, NO
NETSURF_USE_HARU_PDF := NO
+# Enable NetSurf's use of libidn2 for international domain name parsing.
+# Valid options: YES, NO
+NETSURF_USE_IDN := YES
+
# Enable stripping the NetSurf binary
# Valid options: YES, NO
NETSURF_STRIP_BINARY := NO
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index b54fa1e..2fe62b6 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -30,6 +30,7 @@ ifeq ($(HOST),amiga)
$(eval $(call feature_enabled,AMIGA_CAIRO,-DNS_AMIGA_CAIRO,,Cairo))
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
+ $(eval $(call feature_enabled,IDN,-DWITH_IDN,-lidn2,IDNA2008))
CFLAGS += -I /SDK/local/common/include/libpng12
LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lauto -lpbl
@@ -46,6 +47,7 @@ else
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,NSSVG))
$(eval $(call pkg_config_find_and_add_enabled,AMIGA_CAIRO,cairo,Cairo))
+ $(eval $(call feature_enabled,IDN,-DWITH_IDN,-lidn2,IDNA2008))
$(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs,JavaScript))
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index ec19d1b..ff1a450 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -20,7 +20,7 @@ NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
# add a line similar to below for each optional lib here
-# note: webp lacks pkg-config file
+# note: webp and libidn2 lack pkg-config file
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
@@ -31,6 +31,7 @@ $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,VIDEO,gstreamer-0.10,Video))
+$(eval $(call feature_enabled,IDN,-DWITH_IDN,-lidn2,IDNA2008))
# GTK and GLIB flags to disable depricated usage
GTKDEPFLAGS := -DG_DISABLE_SINGLE_INCLUDES \
diff --git a/utils/nsurl.c b/utils/nsurl.c
index c99b0d3..e3d4845 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -25,7 +25,11 @@
#include <libwapcaplet/libwapcaplet.h>
#include <stdlib.h>
#include <string.h>
+#ifdef WITH_IDN
+#include <idn2.h>
+#endif
+#include "desktop/gui_factory.h"
#include "utils/corestrings.h"
#include "utils/errors.h"
#include "utils/log.h"
@@ -681,6 +685,8 @@ static nserror nsurl__create_from_section(const char * const url_s,
char *norm_start = pos_norm;
size_t copy_len;
size_t length;
+ char *output;
+
enum {
NSURL_F_NO_PORT = (1 << 0)
} flags = 0;
@@ -745,7 +751,8 @@ static nserror nsurl__create_from_section(const char * const url_s,
continue;
}
- if (nsurl__is_unreserved(ascii_offset) == false) {
+ if ((section != URL_SCHEME && section != URL_HOST) &&
+ (nsurl__is_unreserved(ascii_offset) == false)) {
/* This character should be escaped after all,
* just let it get copied */
copy_len += 3;
@@ -764,10 +771,10 @@ static nserror nsurl__create_from_section(const char * const url_s,
*(pos_norm++) = (char)ascii_offset;
pos += 2;
pos_url_s = pos + 1;
-
length -= 2;
- } else if (nsurl__is_no_escape(*pos) == false) {
+ } else if ((section != URL_SCHEME && section != URL_HOST) &&
+ (nsurl__is_no_escape(*pos) == false)) {
/* This needs to be escaped */
if (copy_len > 0) {
@@ -816,6 +823,7 @@ static nserror nsurl__create_from_section(const char * const url_s,
/* Mark end of section */
(*pos_norm) = '\0';
+
/* Stage 2: Create the URL components for the required section */
switch (section) {
case URL_SCHEME:
@@ -944,6 +952,17 @@ static nserror nsurl__create_from_section(const char * const url_s,
}
/* host */
+#ifdef WITH_IDN
+ /* Encode the host according to IDNA2008.
+ * This returns the original host if it is already ASCII.
+ */
+ if (idn2_lookup_u8((const uint8_t *)norm_start,
+ (uint8_t **)&output, 0) == IDN2_OK) {
+ length = strlen(output);
+ strcpy(norm_start, output);
+ idn2_free(output);
+ }
+#endif
if (lwc_intern_string(norm_start, length,
&url->host) != lwc_error_ok) {
return NSERROR_NOMEM;
--
1.7.10.4
9 years, 8 months
[PATCH] Add div element in libdom
by Achal-Aggarwal
#Repo : libdom
#sURL : https://github.com/Achal-Aggarwal/libdom.git
#sRef : tokeniser-update
#SHA1 : 9b99072314bd652bfc26791a200a592f8cf1cd44
#Land : master
#link : https://github.com/Achal-Aggarwal/libdom/tree/add-div
#Description
This patch adds div element with align as specialized attribute in the dom and include its test.
Achal-Aggarwal (1):
Implementing div element and adding corresponding test.
Makefile | 1 +
include/dom/dom.h | 1 +
include/dom/html/html_div_element.h | 16 +++
src/html/Makefile | 5 +-
src/html/TODO | 2 +-
src/html/html_div_element.c | 153 +++++++++++++++++++++
src/html/html_div_element.h | 45 ++++++
src/html/html_document.c | 4 +
...vElement01.xml.notimpl => HTMLDivElement01.xml} | 0
9 files changed, 224 insertions(+), 3 deletions(-)
rename test/testcases/tests/level1/html/{HTMLDivElement01.xml.notimpl => HTMLDivElement01.xml} (100%)
--
1.8.3.2
9 years, 8 months