[Grub-dev] C# Grubng 0.1 and few questions
Balinny
balinny at gmail.com
Mon Jan 28 22:39:04 UTC 2008
Bartek Jasicki wrote:
> Użytkownik Balinny napisał:
>
>> Bug report: At Crawler.cs line 77
>> streamw.Write("filedesc://dummy.arc.gz 0.0.0.0 20071005122244 text/plain
>> 69\n1 0 grub.org\nURL IP-address Archive-date Content-type
>> Archive-length\r\n\r\n");
>> Those "\r\n\r\n" should be "\n\n"
>> http://www.archive.org/web/researcher/ArcFileFormat.php specifies "nl ==
>> Unix-newline-delimiter"
>>
>>
>>
>>
>
> Thanks, this fixed if i good think ;)
>
>
> But after server upgrade i get always 401 error on upload - all with
> workunit looks good, thus for now C# client is broke
I also had problems with the C one when the server started to validate
things :P
I recommend you to check the validity of the workunits as the first
step. I spent quite time with a workunit
being rejected which turned out to be wrong.
Now i'm having trouble with server responses: Headers delimited by LF
instead of CRLF, a Content-Type header without value...
(yes, try http://www.etracker.de/soverview.php?c=1&et=3Wsy0)
My code passes it happily to the arc file, which then gets corrupted
with unexpected chars in the mime.
Seeing your code, i see at crawler.cs line 102
streamw.WriteLine("{0} {1} {2} application/x-grub-error 11",
url, ip, date);
streamw.WriteLine("HTTP/1.0 500 Invalid URL\n");
streamw.WriteLine("Invalid URL\n");
Which is wrong twice,
a) HTTP/1.0 500 Invalid URL\n is supposed to be a Server status line, so
you should end it with CRLF, and to have the next text in the body,
with a double one: streamw.WriteLine("HTTP/1.0 500 Invalid URL\r\n\r\n");
b) len ("HTTP/1.0 500 Invalid URL\n" + "Invalid URL\n") > 11 which is
probably corrupting your Arc.
Also, this code strikes me as a Bad Way To Do Things(tm)
if (e.Status.ToString() == "Timeout")
{
page = "No response was received during the
timeout period for a request.";
}
if (e.Status.ToString() == "NameResolutionFailure")
{
page = "The name resolver service could not
resolve the host name.";
}
if (e.Status.ToString() == "SendFailure")
{
page = "A complete request could not be sent to
the remote server.";
}
if (e.Status.ToString() == "TrustFailure")
{
page = "A server certificate could not be
validated.";
}
if (e.Status.ToString() == "ConnectFailure")
{
page = "The remote service point could not be
contacted at the transport level. ";
}
Why not do it in a switch (e.Status) ?
Status names may change in the future, or be localised, but number codes
will remain. Not to mention that toString() will internally do something
like that and string comparisons are slower than numeric ones.
And how would you have a TrustFailure error with http-only?
If you continue having problems, send me the workunit file with the
generated answer and i'll try to find the error.
<spam>In the meantime while the C# client is down, you are all
encouraged to use the working C implementation ;-) </spam>
More information about the Grub-dev
mailing list