mail-archives/mono-bugs/2008-September/078796.html

258 строки
6.6 KiB
HTML
Исходник Постоянная ссылка Обычный вид История

2019-06-06 22:03:35 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 423194] New: Bug In Mono FTP System.Net.FtpWebRequest
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20423194%5D%20New%3A%20Bug%20In%20Mono%20FTP%0A%09System.Net.FtpWebRequest&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="078794.html">
<LINK REL="Next" HREF="078799.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 423194] New: Bug In Mono FTP System.Net.FtpWebRequest</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20423194%5D%20New%3A%20Bug%20In%20Mono%20FTP%0A%09System.Net.FtpWebRequest&In-Reply-To="
TITLE="[Mono-bugs] [Bug 423194] New: Bug In Mono FTP System.Net.FtpWebRequest">bugzilla_noreply at novell.com
</A><BR>
<I>Thu Sep 4 11:20:00 EDT 2008</I>
<P><UL>
<LI>Previous message: <A HREF="078794.html">[Mono-bugs] [Bug 421664] [PATCH] If I create a new interface SomeNamespace. ISerializable, then System.Serializable serialization fails
</A></li>
<LI>Next message: <A HREF="078799.html">[Mono-bugs] [Bug 418620] Sys.Web is prone to &quot;HTTP header injection&quot; attacks
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#78796">[ date ]</a>
<a href="thread.html#78796">[ thread ]</a>
<a href="subject.html#78796">[ subject ]</a>
<a href="author.html#78796">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="https://bugzilla.novell.com/show_bug.cgi?id=423194">https://bugzilla.novell.com/show_bug.cgi?id=423194</A>
Summary: Bug In Mono FTP System.Net.FtpWebRequest
Product: Mono: Class Libraries
Version: 1.9
Platform: i386
OS/Version: SuSE Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">ch.pourchier at sites.fr</A>
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
Found By: DeveloperNet
Description of Problem:
The code below operates under windwos but not Linux file is created, but it
is empty.
I think that the bug is in 'Credentials' because I can download files on
server without authentication(Login/Password).
With my code I was able to download a file on the server
&quot;<A HREF="ftp://ftp-developpez.com/konflor/Latex/formation/FormationLatex.pdf&quot;">ftp://ftp-developpez.com/konflor/Latex/formation/FormationLatex.pdf&quot;</A>
anonymously. But on my local server when I want to download a file with a
loggin and a password, my stream &quot;ResponceStream&quot; is empty and there is no
error. My code works on windows and ftp server! My FTP server is not under
windows!
Sorry for my English I am french
Sub dl(ByVal remoteFile As String, ByVal localFile As String, ByVal
username As String, ByVal password As String)
'1. Create a request: must be in <A HREF="ftp://hostname">ftp://hostname</A> format,
' not just ftp.myhost.com
Dim URI As String = remoteFile
Dim ftp As System.Net.FtpWebRequest = CType(FtpWebRequest.Create(URI),
FtpWebRequest)
'3. Settings and action
ftp.KeepAlive = False
'we want a binary transfer, not textual data
ftp.UseBinary = True
'Define the action required (in this case, download a file)
ftp.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
'2. Set credentials
if not (username = &quot;&quot; andalso password = &quot;&quot;) then
ftp.Credentials = New NetworkCredential( username, password)
end if
'4. If we were using a method that uploads data e.g. UploadFile
' we would open the ftp.GetRequestStream here an send the data
'5. Get the response to the Ftp request and the associated stream
Using response As System.Net.FtpWebResponse = CType(ftp.GetResponse,
System.Net.FtpWebResponse)
Using responseStream As IO.Stream = response.GetResponseStream
'loop to read &amp; write to file
Using fs As New IO.FileStream(localFile, IO.FileMode.Create)
Dim buffer(2047) As Byte
Dim read As Integer = 0
Do
read = responseStream.Read(buffer, 0, buffer.Length)
fs.Write(buffer, 0, read)
Loop Until read = 0 'see Note(1)
responseStream.Close()
fs.Flush()
fs.Close()
End Using
End Sub End Using
responseStream.Close()
End Using
response.Close()
End Using
End Sub
Steps to reproduce the problem:
1.
2.
Actual Results:
File with 0 bytes.
Expected Results:
How often does this happen?
Always
Additional Information:
Solution that I have currently is through a socket with whom I send commands!
--
Configure bugmail: <A HREF="https://bugzilla.novell.com/userprefs.cgi?tab=email">https://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="078794.html">[Mono-bugs] [Bug 421664] [PATCH] If I create a new interface SomeNamespace. ISerializable, then System.Serializable serialization fails
</A></li>
<LI>Next message: <A HREF="078799.html">[Mono-bugs] [Bug 418620] Sys.Web is prone to &quot;HTTP header injection&quot; attacks
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#78796">[ date ]</a>
<a href="thread.html#78796">[ thread ]</a>
<a href="subject.html#78796">[ subject ]</a>
<a href="author.html#78796">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>