[Grub-dev] C# Grubng 0.1 and few questions
Bartek Jasicki
thindil2 at gmail.com
Tue Jan 29 01:43:32 UTC 2008
Użytkownik Balinny napisał:
> 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.
>
>
Ok, thanks again for help, i try this, maybe there is problem with
validation
> 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?
>
>
First - this is only temporary solution, if i meet this error in
workunit i add it to this list. Later i change it
Second - TrustFailure - i get it from workunit - i dont remember what
exactly url it was, but i get this error
> If you continue having problems, send me the workunit file with the
> generated answer and i'll try to find the error.
>
>
Ok, if i fail i call you ;)
> <spam>In the meantime while the C# client is down, you are all
> encouraged to use the working C implementation ;-) </spam>
>
>
<spam>No chances ;) Give me few days and i back to game :D </spam>
More information about the Grub-dev
mailing list