aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog32
-rw-r--r--file.c2
-rw-r--r--form.c5
3 files changed, 35 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e77a18..4e35141 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2017-08-27 Kyle J. McKay <mackyle@gmail.com>
+
+ Correct <base ...> parsing and do not turn a form's GET into POST
+ Bug-Debian: https://github.com/tats/w3m/pull/93
+
+ * form.c:
+ form.c: do not gratuitously turn GET into POST.
+ When encountering a <form ...> tag that contains these values:
+ method="get" enctype="multipart/form-data"
+ Do not transform the method into POST to accomodate enctype.
+ Instead behave in the compatible way that all other browsers
+ behave in this instance and ignore the enctype parameter
+ (treating it as the default application/x-www-form-urlencoded)
+ and perform a "GET" just as the method parameter requests.
+ This behavior produces far more compatible results than
+ gratuitously changing the "get" into a "post" which can
+ result in unexpected "405 Method Not Allowed" errors.
+ Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
+
+ * file.c:
+ file.c: compute correct base URL when not absolute.
+ When a server makes use of the PATH_INFO feature in a CGI,
+ the returned pages may often have a <base href="..." /> tag
+ specifying the URL of the CGI itself as the base.
+ However, to avoid hard-coding the scheme and host into such
+ a base href, the href value will often omit the scheme, host
+ and port.
+ Make sure that when parsing any such base href value that
+ any omitted components are taken from the current URL rather
+ than taken as being from a bare, absolute file:/// URL.
+ Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
+
2017-01-02 Tatsuya Kinoshita <tats@debian.org>
* NEWS: Update NEWS.
diff --git a/file.c b/file.c
index 4d15ff1..9b0e947 100644
--- a/file.c
+++ b/file.c
@@ -5993,7 +5993,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
buf->document_charset);
if (!buf->baseURL)
buf->baseURL = New(ParsedURL);
- parseURL(p, buf->baseURL, NULL);
+ parseURL2(p, buf->baseURL, &buf->currentURL);
#if defined(USE_M17N) || defined(USE_IMAGE)
base = buf->baseURL;
#endif
diff --git a/form.c b/form.c
index 0605513..cc5e3d2 100644
--- a/form.c
+++ b/form.c
@@ -56,10 +56,9 @@ newFormList(char *action, char *method, char *charset, char *enctype,
m = FORM_METHOD_INTERNAL;
/* unknown method is regarded as 'get' */
- if (enctype != NULL && !strcasecmp(enctype, "multipart/form-data")) {
+ if (m != FORM_METHOD_GET && enctype != NULL &&
+ !strcasecmp(enctype, "multipart/form-data")) {
e = FORM_ENCTYPE_MULTIPART;
- if (m == FORM_METHOD_GET)
- m = FORM_METHOD_POST;
}
#ifdef USE_M17N