Modify

Opened 3 years ago

Closed 3 years ago

#17607 closed defect (worksforme)

uhttpd missing CGI variables

Reported by: rcp100@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Barrier Breaker 14.07
Keywords: Cc:

Description

I have a CGI program written in C that I am attempting to call via
uhttpd. Everything appears to work OK except that getenv("REQUEST_METHOD") seg faults and as a result I get a "Bad Gateway" response from uhttpd

The code worked correctly under AA and also under recent trunk revisions.

I have the following packages selected:

uhttpd
uhttpd-mod-tls
uhttpd-mod-ubus

luci-ssl

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by jow

  • Resolution set to worksforme
  • Status changed from new to closed

Cannot reproduce this issue. Also "getenv() seg fault" sounds odd, make sure you have no other unrelated errors in your C code.

$ cat /tmp/cgi.c 
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
	char *m = getenv("REQUEST_METHOD");

	printf("Content-Type: text/plain\r\n\r\nREQUEST_METHOD=%s\n", m ? m : "(unset)");

	return 0;
}

$ STAGING_DIR=~/devel/openwrt.git/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/ ~/devel/openwrt.git/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc -o /tmp/cgi /tmp/cgi.c
$ scp /tmp/cgi root@jj:/www/cgi-bin/
cgi                100% 6150     6.0KB/s   00:00
$ curl http://10.11.12.13/cgi-bin/cgi
REQUEST_METHOD=GET
$ curl -d 'foo' http://10.11.12.13/cgi-bin/cgi
REQUEST_METHOD=POST

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.