Re: http 307 temp redirect not working
Guillaume Tucker <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Henry, The HTTP specification explains how the client should handle unsupported HTTP status codes, and I believe the default cases I have introduced comply to it. So there should not be any mishandling anyway with these default cases. Furthermore, this behavior is also a DLNA compliance requirement (see comments in the code) so we need to implement it. Best regards, Guillaume. Henry Ping wrote: > Thanks, Guillaume. > > I think it's better for us to just fail instead of masking&applying the > default action if we don't recognize the response code. > > New response code can be created in the same category but it may need > special handling, such as 305 response code. Mis-handling it can cause more > problem than not handling it all. > > I will check in part of your changes that catching 307 along with 301 & 302. > > Henry > > >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On >> Behalf Of Guillaume Tucker >> Sent: Friday, October 17, 2008 2:22 AM >> To: [email protected] >> Subject: Re: [Helix-client-dev] http 307 temp redirect not working >> >> Dear Henry, >> >> I have corrected the HTTP status codes issues, adding default >> cases for 2xx and 3xx values. I do not have write access to >> the source, but I thought you may want to apply the diff >> below. This has solved our redirection problem. >> >> Best regards, >> Guillaume. >> >> >> =================================================================== >> RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v >> retrieving revision 1.128 >> diff -u -r1.128 httpfsys.cpp >> --- httpfsys.cpp 6 Oct 2008 18:02:22 -0000 1.128 >> +++ httpfsys.cpp 17 Oct 2008 09:11:35 -0000 >> @@ -8491,6 +8491,7 @@ >> >> HXLOGL1(HXLOG_HTTP, "HandleHeaderRead: HTTP >> header status ==> %lu", ulHTTPStatus); >> >> + >> if(pMessage->majorVersion() > 0) >> { >> switch(ulHTTPStatus) >> @@ -8524,7 +8525,8 @@ >> } >> // No break, intentional fall-through >> >> - case 200: // Success >> + case 200: // Success >> + default_2xx: // Default success >> { >> if (m_bCheckingWhetherByteRangeWorks) >> { >> @@ -8570,8 +8572,19 @@ >> retVal = >> _HandleSuccess(pMessage, pBuffer, ulHeaderLength); >> } >> break; >> - case 400: // Fail >> - case 404: // Not Found >> + >> + case 301: >> + case 302: >> + case 307: >> + default_3xx: // Default redirect >> + { >> + retVal = _HandleRedirect(pMessage); >> + } >> + break; >> + >> + case 400: // Fail >> + case 404: // Not Found >> + default_4xx: // Default failure >> { >> retVal = _HandleFail(ulHTTPStatus); >> } >> @@ -8582,13 +8595,6 @@ >> retVal = >> _HandleUnAuthorized(pMessage, pBuffer, ulHeaderLength); >> } >> break; >> - case 301: // Redirect >> - case 302: // Redirect >> - { >> - retVal = _HandleRedirect(pMessage); >> - } >> - break; >> - >> case 416: // Invalid range request >> m_LastError = HXR_INVALID_PARAMETER; >> m_pFileResponse->SeekDone(HXR_FAILED); >> @@ -8597,7 +8603,18 @@ >> >> default: >> { >> - retVal = _HandleFail(400); >> + // DLNA compliance >> + // Any 2xx status codes not >> explicitly handled >> + // must be treated as 200 >> + if ((ulHTTPStatus >= 200) && >> (ulHTTPStatus >> < 300)) >> + goto default_2xx; >> + >> + // Default 3xx code : redirect >> + if ((ulHTTPStatus >= 300) && >> (ulHTTPStatus >> < 400)) >> + goto default_3xx; >> + >> + // Other code : failure >> + goto default_4xx; >> } >> break; >> }; >> >> >> _______________________________________________ >> Helix-client-dev mailing list >> [email protected] >> http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev >> > > > _______________________________________________ Helix-client-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev