Put URL failing -- HTTP header problems?
Sivakatirswami
katir at hindu.org
Wed May 10 19:04:58 EDT 2006
On May 10, 2006, at 5:53 AM, Rob Cozens wrote:
> Sannyasin,
>
>> I think I am close the source of the problem which at this point I
>> take to be the spurious introduction of "char[13]" into what
>> should be line delimited lists. Where this char(13) is present in
>> a GET request URL, libURL fails. (of course)
>>
>>
>
> numToChar(13) is included in the text returned by:
>
> put URL tStartURL into tMainListing
>
> Aloha!
Right... as suspected... The team at the Palm & Cycad Societies of
Australia must use Macs... perhaps even old macs. Thus their web
pages include char (13) an old problem my own *nix team members would
gripe about "Hey! Your files are one long line!" (smile)
But then, is it normal behavior? when parsing such a page thusly:
put URL tStartURL into tMainListing
REPEAT for each line x in tMainListing
IF x contains "/palms/" THEN # we got one for sure
put x & cr after tPalmList
END IF
END REPEAT
for char(13) to passed along with "each line" to x ??
At any rate.. periodic use of
replace numtoChar(13) with "" in tGenusListing
in the script whereever the content was being passed from the web
page cured the problem... because it appears that char(13) is making
it all the way thru this routine right into the last variable.
put URL tStartURL into tMainListing
REPEAT for each line x in tMainListing
IF x contains "/palms/" THEN # we got one for sure
put x & cr after tPalmList
END IF
END REPEAT
--check it out
delete line 1 to 2 of tPalmList
delete line -1 of tPalmList
put "<[^><]*>" into tRex
put replacetext(tPalmList, tRex, "") into tPalmsList
replace " " with "" in tPalmsList
REPEAT for each line x in tPalmslist
put "http://www.pacsoa.org.au/palms/" before x
put x & cr after tGenusListing
END REPEAT
# OK at this point an examintion of tGenusListing shows
# presence of char(13) at the end of each instance of x in that variable
# fix
replace numtoChar(13) with "" in tGenusListing
Anyway, case closed for now... tha caveat being: it appears there are
contexts within Rev where char(13) is not translated to char (10) (I
thought this was automatic) where the data is piped in from libURL
and not being read from disk. This analysis could be wrong.. I don't
know enough about it.. other than to know there is a line end snake
pit there somewhere:
Sivakatirswami
Dave: yes, wiping char (13) in url string could help, but I think we
are talking a complete data file here...
Tereza: Yes, manipulating vars inside repear for each loops can be
nasty... but it's not the issue here.
>
> Rob Cozens
> CCW, Serendipity Software Company
>
> "And I, which was two fooles, do so grow three;
> Who are a little wise, the best fooles bee."
>
> from "The Triple Foole" by John Donne (1572-1631)
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list