Project

General

Profile

[Solved] how to get application/x-www-form-urlencoded parsed?

Added by Anonymous over 4 years ago

An applet coded

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />

provides through JS

Request.post('/cgi-bin/cgi-exec', postdata, {
            headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        }

however lighttpd responds with

Content-Type application/ *octet-stream*

Does support for this MIME type application/ x-www-form-urlencoded require a special compile-time feature to be set? Or else how to get this working?

__

lighttpd/1.4.54 (ssl) - a light and fast webserver

Event Handlers:

        + select (generic)
        + poll (Unix)
        + epoll (Linux)
        - /dev/poll (Solaris)
        - eventports (Solaris)
        - kqueue (FreeBSD)
        - libev (generic)

Network handler:

        + linux-sendfile
        - freebsd-sendfile
        - darwin-sendfile
        - solaris-sendfilev
        + writev
        + write
        - mmap support

Features:

        + IPv6 support
        + zlib support
        - bzip2 support
        + crypt support
        + SSL support
        + PCRE support
        - MySQL support
        - PgSQL support
        - DBI support
        - Kerberos support
        - LDAP support
        - PAM support
        - memcached support
        - FAM support
        + LUA support
        + xml support
        + SQLite support
        + GDBM support


Replies (4)

RE: how to get application/x-www-form-urlencoded parsed? - Added by gstrauss over 4 years ago

Your CGI (/cgi-bin/cgi-exec) must respond with appropriate response headers.
See https://tools.ietf.org/html/rfc3875 The Common Gateway Interface (CGI) Version 1.1

RE: how to get application/x-www-form-urlencoded parsed? - Added by Anonymous over 4 years ago

Thank you for pointing that out. Apparently the response header seems indeed not being specified.

RE: [Solved] how to get application/x-www-form-urlencoded parsed? - Added by Anonymous over 4 years ago

The cause for the issue been that lighttpd does not follow symlinks in /www/cgi-bin/ , even when

setting server.follow-symlink = "enable"
, but instead it delivers symlinked CGI programs as files. With the whitelist restrictions for the CGI exec path
cgi-bin/cgi-exec

had to be explicitly assigned (cgi.assign) and remedies the issue.

RE: [Solved] how to get application/x-www-form-urlencoded parsed? - Added by gstrauss over 4 years ago

Your solution is correct, but your analysis is incorrect.

server.follow-symlink = "enable" follows symlinks, as expected.

The path "/cgi-bin" is not magical.

Plain and simple: configuring cgi.assign is required for lighttpd to use mod_cgi to handle the request.

    (1-4/4)