Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending HTTP headers #36

Open
kpocza opened this issue Jul 3, 2018 · 5 comments
Open

Sending HTTP headers #36

kpocza opened this issue Jul 3, 2018 · 5 comments

Comments

@kpocza
Copy link

kpocza commented Jul 3, 2018

When doing a PoC for MSOffice/LibreOffice editing feature while putting the documents on a WebDAV address pointed by a href links I noticed that the HTTP headers are not sent in case of GET requests.

NWebDav is hosted on ASP.NET (not Core).

To temporarily overcome the issue I had to add a flush method that flushes the content to the response before starting to write the actual content. The flush is called before the "if (!head) await CopyToAsync" statement in GetAndHeadHandler.cs.
I don't know if something similar is required for ASP.NET Core, HttpListener and for other HTTP verbs.

@ramondeklein
Copy link
Owner

Could you please post the code that you have changed?

@kpocza
Copy link
Author

kpocza commented Jul 4, 2018

Sure.
Please give me some time as I made the changes on my office computer and I'm on holiday at the moment. I can do it earliest at the end of next week.

@kpocza
Copy link
Author

kpocza commented Jul 13, 2018

I've created a diff:
flush.zip

The ASP.NET version has been changed and tested in case of GET requests only. I don't know how the library behaves in other environments and other VERBs. This is the reason I send just a diff and not a pull request.

@ramondeklein
Copy link
Owner

Can you explain how I can reproduce the original problem? I rather not pollute the generic IHttpResponse namespace for these "edge-cases".

@kpocza
Copy link
Author

kpocza commented Jul 16, 2018

I've run two test cases. In both cases I applied a disk based web handler pointing to the same location. My minisite hosted a page having a link to a LibreOffice odt file this way: doc2

I clicked the link to start editing in LibreOffice.

Specialities of the two test cases:

  1. The first one was performed with the original NWebDav library
  2. The second one was performed with the modified library according to flush.zip attached before

I've captured the communication via Fiddler.

Result of the first run:
noflushresponse

Line 5 is the result of the GET request sending content type of text/html. Line 3, 4 are propfinds also with bad content type.

Result of the second run:
flushresponse

Line 5 shows the right content type here (while propfinds are still wrong as I haven't modified the respective handler).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants