Re: NSURLRequest WebDAV Upload Problem
Re: NSURLRequest WebDAV Upload Problem
- Subject: Re: NSURLRequest WebDAV Upload Problem
- From: Yuri Selukoff <email@hidden>
- Date: Tue, 28 Jul 2009 04:55:42 +0400
Alex,
In this case there's some problem with this particular t-online.de
server.
Looks like this server doesn't handle chunked bodies correctly.
Here's a part of the network log when I'm trying to put a chunked body
to it (see below).
As you can see, server negotiates fine, until it is given a chunked
body. Then it responds with "HTTP/1.1 400 Incomplete file was
uploaded". I'm not sure if this applies to your case, but if you use a
streamed body, like I do here, it should be transferred as a chunked
body, so it might be relevant.
Can you contact that server's tech support to clarify this issue?
Yuri.
The log:
2009-07-28 04:45:19.119 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:19.124 GoodReader[2888:207] request: LOCK /Dokumente/
assert.pdf HTTP/1.1
User-Agent: GoodReader for iPhone
Host: webdav.mediencenter.t-online.de
Depth: 0
Timeout: Second-600
Content-Type: application/xml; charset="utf-8"
Content-Length: 242
Authorization: Digest username="email@hidden",
realm="webdav.mediencenter.t-online.de",
nonce
="HkpuSgAAAAC6bg4AAAAAAA==fe1d9842498753945c0168a5868be71d1a265d97",
uri="/Dokumente/assert.pdf",
response="18c8e4ecb4cb84fffb0805fc0637821d", opaque="+HA+FE
+00dlsfront06+000++1248741905426982", algorithm="MD5",
cnonce="219fafb81ee0da206f5456a862ad33e9", nc=00000001, qop="auth"
<?xml version="1.0" encoding="utf-8"?><D:lockinfo xmlns:D="DAV:">
<D:lockscope><D:exclusive/></D:lockscope> <D:locktype><D:write/></
D:locktype> <D:owner> <D:href>http://www.goodiware.com/goodreader.html
</D:href> </D:owner></D:lockinfo>
2009-07-28 04:45:19.137 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:20.022 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:20.026 GoodReader[2888:207] response: HTTP/1.1 200 OK
Date: Tue, 28 Jul 2009 00:45:19 GMT
Server: Apache
Lock-Token: <opaquelocktoken:452ba397-e46f-4de8-91a6-9893a7e5aeed>
X-Dav-Powered-By: Zend_Webdav_Server
Accept-Ranges: bytes
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Length: 508
Vary: User-Agent,Accept-Encoding
Connection: close
Content-Type: text/xml; charset=utf-8
2009-07-28 04:45:20.032 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:20.038 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:20.043 GoodReader[2888:207] response body: <?xml
version="1.0" encoding="UTF-8"?>
<d:prop xmlns:d="DAV:">
<d:lockdiscovery>
<d:activelock>
<d:locktoken>
<d:href>opaquelocktoken:452ba397-e46f-4de8-91a6-9893a7e5aeed</
d:href>
</d:locktoken>
<d:locktype>
<d:write/>
</d:locktype>
<d:lockscope>
<d:exclusive/>
</d:lockscope>
<d:owner>
<d:href>http://www.goodiware.com/goodreader.html</d:href>
</d:owner>
<d:depth>0</d:depth>
<d:timeout>Second-600</d:timeout>
</d:activelock>
</d:lockdiscovery>
</d:prop>
2009-07-28 04:45:20.055 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:20.085 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:20.089 GoodReader[2888:207] request: PUT /Dokumente/
assert.pdf HTTP/1.1
User-Agent: GoodReader for iPhone
Host: webdav.mediencenter.t-online.de
If: (<opaquelocktoken:452ba397-e46f-4de8-91a6-9893a7e5aeed>)
Content-Type: application/octet-stream
Authorization: Digest username="email@hidden",
realm="webdav.mediencenter.t-online.de",
nonce
="HkpuSgAAAAC6bg4AAAAAAA==fe1d9842498753945c0168a5868be71d1a265d97",
uri="/Dokumente/assert.pdf",
response="927d06e184c83b70636b88ef1c760837", opaque="+HA+FE
+00dlsfront06+000++1248741905426982", algorithm="MD5",
cnonce="219fafb81ee0da206f5456a862ad33e9", nc=00000002, qop="auth"
2009-07-28 04:45:20.095 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:26.472 GoodReader[2888:207]
------------------------------------------------
2009-07-28 04:45:26.477 GoodReader[2888:207] response: HTTP/1.1 400
Incomplete file was uploaded
Date: Tue, 28 Jul 2009 00:45:20 GMT
Server: Apache
Content-Length: 0
Connection: Close
Vary: User-Agent,Accept-Encoding
Content-Type: text/html; charset=utf-8
2009-07-28 04:45:26.482 GoodReader[2888:207]
------------------------------------------------
On 28.07.2009, at 03:30, Mark Pauley wrote:
The problem is that we may have to re-try the request with
authentication. At that point your upload is toast. This works on
the mac because we cheat and write your stream to disk so we can re-
start it. Said functionality doesn't exist on the phone.
That being said, we should at least give you an error and not just
hang.
On Jul 27, 2009, at 4:04 PM, TomMarchand wrote:
How large can the files be?
On Jul 27, 2009, at 4:34 PM, Alexander von Below wrote:
Thanks, if it makes a difference I will gladly file a bug against
radar.
But please allow lame-brain-me to ask you to clarify:
1) "there's some issue restarting the request even though you're
using an NSData object"
Why would a request with an NSData object need to restart?
2) "your operation would be expected to not work if you were
attempting a streamed upload"
Maybe I should explain the reason why I am using NSStream: I am
trying to upload potentially very large files with an iPhone, and
I thought that would be the best way to do it.
But possibly, - [NSData dataWithContentsOfMappedFile:] is the
better workaround ?
Alex
Am 27.07.2009 um 21:57 schrieb Mark Pauley:
Your webdav server requires authentication, so there's some issue
restarting the request even though you're using an NSData object
which should be idempotent and therefore work.
I'll look into this.
Just to be pedantic: your operation would be expected to not work
if you were attempting a streamed upload because we currently
don't have any API that will allow the client to restart a stream.
On Jul 27, 2009, at 11:29 AM, Alexander von Below wrote:
Positive. Not only are they called when I am setting the body
with an NSData object, but both
- (NSURLRequest *)connection:(NSURLConnection *)connection
willSendRequest:(NSURLRequest *)request
redirectResponse:(NSURLResponse *)response
and
-(void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge
*)challenge {
NSURLCredential *newCredential;
are called in the failure case.
Alex
Am 27.07.2009 um 20:25 schrieb TomM:
Are you sure that you configured the delegates correctly?
On Mon, Jul 27, 2009 at 8:33 AM, Alexander von Below <email@hidden
> wrote:
Hello,
I have an odd issue communicating with a specific WebDAV
Server, and I am attempting to find out where exactly to find
the problem:
* Is it the server?
* Is it my code?
* Is it the Apple SDK?
* All of the above?
The main problem is, that when I am using an
NSMutableURLRequest with an HTTPBodyStream (emphasis on
"Stream"), then apparently none of the completion delegate
methods are ever called. Specifically, none of
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSHTTPURLResponse *)response;
- (void)connectionDidFinishLoading:(NSURLConnection
*)theConnection;
- (void)connection:(NSURLConnection *)theConnection
didFailWithError:(NSError *)error;
are ever invoked, not even with a timeout.
On the Mac, or if I set the HTTPBody using an NSData object on
the iPhone, everything works.
I have included a sample project with targets both for Mac OS X
and the iPhone.
To reproduce, get a free account at http://mediencenter.t-online.de
(or eMail me for help on that)
Build the PUTStreamTest Target for the iPhone Simulator or
device, enter username and password, and select "Stream". Then
press PUT
The expected result is that the completion delegate methods are
called, and an alert informs you of failure or success.
The actual result is that the delegate methods are not called.
I would be very happy if someone could give me a hint where to
look. I do have access to the people who maintain that server,
but before I approach them I would like to make sure that my
code is correct. Their WebDAV is running in production, and
they claim it has no issues with other clients.
Sample at: http://software.vonbelow.com/PUTStreamTest.zip
Thanks,
Alex
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_Mark
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_Mark
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@cdmax.ru
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden