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

Fixed contenttype header being null #1191

Merged
merged 2 commits into from Sep 26, 2019

Conversation

@ByteHamster
Copy link
Member

ByteHamster commented Sep 9, 2019

Closes #1183 (replaced)
Fixes #1178
Fixes (after a release) sabre-io/Baikal#823
Fixes (after a release) sabre-io/Baikal#819

@staabm
staabm approved these changes Sep 9, 2019
Copy link
Member

staabm left a comment

Any chance for a unit test?

@codecov

This comment has been minimized.

Copy link

codecov bot commented Sep 9, 2019

Codecov Report

Merging #1191 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1191      +/-   ##
============================================
+ Coverage     97.17%   97.17%   +<.01%     
- Complexity     2872     2873       +1     
============================================
  Files           174      174              
  Lines          8067     8068       +1     
============================================
+ Hits           7839     7840       +1     
  Misses          228      228
Impacted Files Coverage Δ Complexity Δ
lib/CardDAV/Plugin.php 96.93% <100%> (ø) 128 <0> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f6fdea...7badab4. Read the comment docs.

@ByteHamster

This comment has been minimized.

Copy link
Member Author

ByteHamster commented Sep 9, 2019

Any chance for a unit test?

Unfortunately not. I did not manage to reproduce the issue in a test:

public function testIssue1183()
{
    $request = HTTP\Sapi::createFromServerArray([
        'REQUEST_METHOD' => 'PROPFIND',
        'HTTP_CONTENT_TYPE' => 'application/xml',
        'REQUEST_URI' => '/calendars/user1'
    ]);


    $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
<d:propfind xmlns:d="DAV:">
    <d:prop>
        <d:current-user-principal />
    </d:prop>
</d:propfind>');

    $response = $this->request($request);

    echo $response->body;
}

The response body is the following, while according to sabre-io/Baikal#819 (comment) sabre/dav should crash.

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:s="http://sabredav.org/ns">
   <d:response>
      <d:href>/calendars/user1/</d:href>
      <d:propstat>
         <d:prop>
            <d:current-user-principal />
         </d:prop>
         <d:status>HTTP/1.1 404 Not Found</d:status>
      </d:propstat>
   </d:response>
   <d:response>
      <d:href>/calendars/user1/calendar1/</d:href>
      <d:propstat>
         <d:prop>
            <d:current-user-principal />
         </d:prop>
         <d:status>HTTP/1.1 404 Not Found</d:status>
      </d:propstat>
   </d:response>
</d:multistatus>
@DeepDiver1975

This comment has been minimized.

Copy link
Member

DeepDiver1975 commented Sep 11, 2019

@ByteHamster Try setting the user agent header - the code is only triggered for SOGO - see

if (false === strpos((string) $this->server->httpRequest->getHeader('User-Agent'), 'Thunderbird')) {

@ByteHamster ByteHamster force-pushed the ByteHamster:empty-contenttype branch from 75642a7 to e6af9cf Sep 11, 2019
@ByteHamster ByteHamster force-pushed the ByteHamster:empty-contenttype branch from e6af9cf to 7badab4 Sep 11, 2019
@DeepDiver1975 DeepDiver1975 merged commit 99b58e0 into sabre-io:master Sep 26, 2019
2 checks passed
2 checks passed
PrettyCI Code formatting
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.