Tags:
create new tag
, view all tags

Bug: Error when using urlparameter with space inside

The error happends when including a .PHP script in twiki and passing GET variables with whitespace between those.

Test case

http://twiki.stibo.dk/bin/view/Sandbox/NipTest1?date=04-12-03&time=12:14&alarmnumber=117&init_id=0&teksten=test%20buffer&error=error-no_init&action=Retry The %20 produces this error:


Bad Request Your browser sent a request that this server could not understand. The request line contained invalid characters following the protocol string.
The apache log gives this error: [Thu Dec 4 09:43:32 2003] null: Argument "neo.ctp.aas.dk" isn't numeric in subroutine entry at /usr/lib/perl/5.6.1/Socket.pm line 286.

I use this from PHP:


$string = ref()."?date=".$date."&time=".$time."&alarmnumber=".$anum."&init_id=".$init."&teksten=".$text."&error=".$error."&action=Retry";
header("location: $string");
I use this from Twiki:
%INCLUDE{http://neo.ctp.aas.dk/~nip/new/alarm/alarm.php?date=%URLPARAM{"date"}%&time=%URLPARAM{"time"}%&alarmnumber=%URLPARAM{"alarmnumber"}%&reason=%URLPARAM{"reason"}%&init_id=%URLPARAM{"init_id"}%&teksten=%URLPARAM{"teksten"}%&error=%URLPARAM{"error"}%&action=%URLPARAM{"action"}%}%

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Linux 2.4.18-686-smp
Web server: Apache
Perl version: 5.6.1
Client OS: Debian Linux
Web Browser: Mozilla 1.6a

-- NickyPrecht - 04 Dec 2003

Follow up

This is spec, not a bug. If you use %URLPARAM{"reason"}% you will get de-escaped spaces. That is, if you want to pass URL parameters to a URL you need to escape them again, as in: %URLENCODE{"%URLPARAM{"reason"}%"}%

See details in TWikiVariables

Yep! Sorry about that. I tried to use URLENCODE on the whole include string in various ways, but without success. The String:
%INCLUDE{"http://neo.ctp.aas.dk/~nip/new/alarm/alarm.php?date=%URLENCODE{"%URLPARAM{"date"}%"}%&time=%URLENCODE{"%URLPARAM{"time"}%"}%&alarmnumber=%URLENCODE{"%URLPARAM{"alarmnumber"}%"}%&reason=%URLENCODE{"%URLPARAM{"reason"}%"}%&init_id=%URLENCODE{"%URLPARAM{"init_id"}%"}%&teksten=%URLENCODE{"%URLPARAM{"teksten"}%"}%&error=%URLENCODE{"%URLPARAM{"error"}%"}%&action=%URLENCODE{"%URLPARAM{"action"}%"}%"}%
Works!

Fix record

Topic attachments
I Attachment Action Size Date Who Comment
Texttxt alarm.php.txt manage 5.2 K 2003-12-04 - 09:42 NickyPrecht The page that gives the error
Texttxt setup.php.txt manage 5.9 K 2003-12-04 - 09:42 NickyPrecht The setup file used
Topic revision: r3 - 2003-12-08 - NickyPrecht
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.