Trouble using 4 commands in one Get

#1
Hi,
I'm using four commands in one Get to write the PNS memory, but the fourth one doesn't seem to work. Am I right in reading the manual as "four is ok, more is bad"?
The URL is:
send.cgi?12=24011&12=25022&12=26033&12=27044
which I expect to write 11 into location 24, 22 into 25, 33 into 26 and 44 into 27. I have a simple loop in a PicAxe attached to the PNS that's reading the locations from the PNS RAM. I see the first three update as expected, but the last location doesn't change.
I can reorder the commands and it's always the last one that doesn't work.
Any ideas please??
Cheers
Simon
 
#2
I've done some more testing to no avail. Here's where I've got to. No extra circuitry added to the PNS, just connected to computer through a hub.
Web page Test.cgi contains this:
<code><pre><font size=2 face='Courier'>&lt;html&gt;&lt;head&gt;&lt;/head&gt;
&lt;body&gt;24=?24, 25=?25, 26=?26, 27=?27&lt;/body&gt;&lt;/html&gt; </font></pre></code>
Use brower to load these URLs one at a time to zero the memory:
<code><pre><font size=2 face='Courier'>http://.../Test.cgi?12=24000 </font></pre></code>
<code><pre><font size=2 face='Courier'>http://.../Test.cgi?12=25000 </font></pre></code>
<code><pre><font size=2 face='Courier'>http://.../Test.cgi?12=26000 </font></pre></code>
<code><pre><font size=2 face='Courier'>http://.../Test.cgi?12=27000 </font></pre></code>
The response each time shows the memory being zeroed ok. After the last one, the display looks like this, as you'd expect :
<code><pre><font size=2 face='Courier'>24=0, 25=0, 26=0, 27=0 </font></pre></code>
Now try updating all four locations in one go with this:
<code><pre><font size=2 face='Courier'>http://.../Test.cgi?12=24001&amp;12=25002&amp;12=26003&amp;12=27004 </font></pre></code>
The result is this:
<code><pre><font size=2 face='Courier'>24=1, 25=2, 26=3, 27=0 </font></pre></code>
You can change the order of the operands in the URL and it's always the last one that is ignored.
I've not tried this with any other commands, only with command 12. I've tried various sorts of padding on the end with no luck.
Anyone had success with stacking up four commands of any sort? As far as I can tell, the sample web site uses at most three.
 
#3
I've tried a few more combinations of four commands.

First using the HTTP Get Test wizard and the PNS with no extra circuitry involved.
Test 1: Goto LCD(0), Goto LCD(0), Goto LCD(0), LCD(&quot;ABCD&quot;)
Result: Just get A printed out on the LCD - so the fourth command is doing something but is getting truncated.
Test 2: Goto LCD(0), LCD(&quot;ABC&quot;), LCD(&quot;DEF&quot;), LCD(&quot;GHI&quot;)
Result: Get ABCDEFG printed out

Now with a PicAxe hanging on the serial output pin of the PNS connector, using a browser to send the GETs....

Test3: SerOut(&quot;a&quot;)&amp;Serout(&quot;b&quot;)&amp;SerOut(&quot;c&quot;)&amp;SerOut(&quot;de&quot;)
Result: only &quot;abcd&quot; received

So looks like the parameter of the 4th command is truncated to one character. One more test to check this out...

Test4: Goto LCD(0), Goto LCD(0), Goto LCD(0), SerByte(123)
Result: byte 1 on serial output
Test5: Goto LCD(0), Goto LCD(0), Goto LCD(0), SerByte(012)
Result: byte 0 on serial output

So I think that's pretty conclusive - command 4 doesn't work unless its value can be given in just one character. Can someone out there try this and confirm I'm not going mad??!!
 

hippy

Technical Support
Staff member
#4
I don't have a PNS configured so cannot confirm what you are getting. As far as I can see there are two possibilities; a 'buffer overflow' type problem, or the PNS URL parser isn't doing what it should.

There should be an 80 character buffer for the GET request according to page 42 of the NET001.PDF, and even taking into account &quot;GET&quot;, spaces and trailing CR-LF's your command length should be under that.

It could be that the buffer is not as big as stated ( Technical would have to answer that ), or it could be 80 characters which points to a parsing problem.

Where you have problems with setting the last of four variables ...

http://.../Test.cgi?12=24001&amp;12=25002&amp;12=26003&amp;12=27004

have you tried setting five variables ( or an earlier one again ) ...

http://.../Test.cgi?12=24001&amp;12=25002&amp;12=26003&amp;12=27004&amp;12=24005

If the fourth variable (27) is set to 004 then it would indicate that it's not a line too long issue, but a parsing one.

You could also try ...

http://.../Test.cgi?***&amp;12=27000&amp;12=27123

And replace *** with commands of variable length ( LCD display poking is probably easiest ) to see if there is a consistent length of command at which it stops doing what it should.
 
#5
Hippy - the URLs are around 50 characters in length so I don't think I'm hitting the 80 character limit.
The shortest I can make it is using ?8=0&amp;8=0&amp;8=0&amp;9=xy, which only displays the x, whereas ?8=0&amp;8=0&amp;9=abcdefgh is longer but displays all 8 characters. so I don't think the problem is the limit is less than the advertised 80.
I've tried using 5 commands, and the last one is always ignored. Having one doesnt mend the 4th one either.
I have found that the URL parser behaves a bit odd with respect to leading zeroes in the command name -if you have too many the command is ignored. You can have a three digit name, but not a four digit one. So ?008=0&amp;9=abc will write abc to the start of the LCD but ?0008=0&amp;9=abc will write it to the current position (ie. the first command is ignored). On the other hand, the value seems able to be any length but then works strangely, though I can't see the pattern. For example ?8=2570&amp;9=abc writes abc half way along the second line while ?8=02570&amp;9=abc writes it near the beginning of the first. So the parser is happy to have the value overflow, but its not just converting the characters to a number by a simple *10 loop.
Hmm. Maybe the command names are also converted in this strange way, so the odd values could be treated as any random command - time to stop fiddling before I break something!
Let's hope Technical come back from Christmas holidays full of enthusiasm to try it on one of their PNSs.
 

hippy

Technical Support
Staff member
#6
Command names should all be two digit with leading zeroes as required, no more and no less than two digits. Odd behaviour can be expected when that's not adhered to - As you've found out :)
 
#7
While most examples in the manual use leading zeros, there are several showing no leading zeros, eg. &quot;GET commands.cgi?1=4&amp;1=5&quot; on page 41. I've had no trouble with doing this. There's also some examples of its use in the sample web site (see commands.cgi where it writes to the LCD).
Where two digits are essential, with leading zero for small numbers, is in the &quot;server side&quot; scripting - that is the ?nn directives in the *.cgi files - but for the &quot;cgi&quot; commands in the URL one or two digit names are ok from what I've seen.
 
Top