2009/3/27 erik quanstrom <quans...@quanstro.net>:
>> It seems I'm hitting this error when sending some GET requests:
>>
>> In /sys/src/cmd/webfs/url.c:
>>
>>       if(strstr(url, "%00")){
>>               werrstr("escaped NUL in URI");
>>               return -1;
>>       }
>>
>> I haven't fully understood the comment above, especially if it is against
>> the RFC to have an escaped NUL in an url, but this can actually happen,
>> at least with queries to a bittorrent tracker. For example when specifying
>> the info hash of a specific torrent when sending a scrape request:
>>
>> http://bttracker.debian.org:6969/scrape?info_hash=%F1%AE%D2%E5%15%A0%BD%F1%41%54%9D%44%00%47%AB%97%81%2B%69%16
>> (13th char in the info hash is a NUL)
>>
>> I get a reply to that one both with wget on linux or hget on plan 9,
>> while webfs gives the error from the code above.
>>
>> So is it webfs that needs fixing for that case, or are the other tools
>> breaking some RFC with that?
>
> rfc2396 doesn't mention any restrictions; %00 is legal.

Yeah, there aren't any. That's the point of URL encoding; NULL bytes
are as acceptable as any other, and your client should be able to
handle them -- so I think that webfs check is just bogus. It should
just encode it as a \0 and pass it through.

--dho

> - erik
>
>

Reply via email to