[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in HTTP API (ENCODERR4) (fwd)

Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>

---------- Forwarded message ----------
Date: Wed, 22 Jun 2005 00:46:31 -0500 (CDT)
From: c.vitroler@xxxxxxxxx
To: webcomment@xxxxxxxxxxxxxxxx
Subject: Bug in HTTP API (ENCODERR4)

There seems to be a bug in line 0428.00 of ENCODERR4. Spaces in the URL get replaced by "?" instead of "+".

     c                   when      wwDeref = dsEnc_Space
     c                   eval      %subst(wwResChar:1:1) =
     c                                  %subst(dsEnc_Spec:5:1)

where: dsEnc_Spec='/<>&?+%=@"'',;:$#\[]{}^`|'

I am not sure if the offset of 5 is wrong and should be 6 or if the character at offset 5 should be "+" instead of "?". Why using a table anyway instead of replacing the space with a plus sign? It is pretty unlikely that the specs of URL encoding will change. IMHO just a waste of processor cycles (as dsEnc_Spec is a variable, not a constant, the CPU has to constantly calculate the offset and get the result via a pointer)

Being basically a Pascal/C programmer I strongly encourage the use of constants, which is a rather foreign concept to RPG/400 programmers. But one can got too far at times, esp. in cases where no changes are ever to be expected! In this case, it only leads to a really nasty bug (it renders the HTTP_URL_ENCODER useless!)
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr