@@ -82,18 +82,14 @@ function httpGet(RequestInterface $request, ResponseInterface $response) {
8282
8383 if (!$ node instanceof IFile) return ;
8484
85- if ($ request ->getHeader ('X-Sabre-Original-Method ' ) === 'HEAD ' ) {
86- $ body = '' ;
87- } else {
88- $ body = $ node ->get ();
89-
90- // Converting string into stream, if needed.
91- if (is_string ($ body )) {
92- $ stream = fopen ('php://temp ' , 'r+ ' );
93- fwrite ($ stream , $ body );
94- rewind ($ stream );
95- $ body = $ stream ;
96- }
85+ $ body = $ node ->get ();
86+
87+ // Converting string into stream, if needed.
88+ if (is_string ($ body )) {
89+ $ stream = fopen ('php://temp ' , 'r+ ' );
90+ fwrite ($ stream , $ body );
91+ rewind ($ stream );
92+ $ body = $ stream ;
9793 }
9894
9995 /*
@@ -249,13 +245,13 @@ function httpOptions(RequestInterface $request, ResponseInterface $response) {
249245 function httpHead (RequestInterface $ request , ResponseInterface $ response ) {
250246
251247 // This is implemented by changing the HEAD request to a GET request,
252- // and telling the request handler that is doesn't need to create the body.
248+ // and dropping the response body.
253249 $ subRequest = clone $ request ;
254250 $ subRequest ->setMethod ('GET ' );
255- $ subRequest ->setHeader ('X-Sabre-Original-Method ' , 'HEAD ' );
256251
257252 try {
258253 $ this ->server ->invokeMethod ($ subRequest , $ response , false );
254+ $ response ->setBody ('' );
259255 } catch (Exception \NotImplemented $ e ) {
260256 // Some clients may do HEAD requests on collections, however, GET
261257 // requests and HEAD requests _may_ not be defined on a collection,
0 commit comments