You are not logged in.
Pages: 1
Would it be possible to add Html status code 206 (Partial Content) to the list of html status codes as well as to StatusCodeIsSuccess? This is needed when manually serving files such as audio and video files.
I added the following to mormot.pas to test:
/// HTML Status Code for "Partial Content"
HTML_PARTIALCONTENT = 206;
changed StatusCodeIsSuccess so:
function StatusCodeIsSuccess(Code: integer): boolean;
begin
case Code of
HTML_SUCCESS, HTML_NOCONTENT, HTML_CREATED, HTML_PARTIALCONTENT,
HTML_NOTMODIFIED, HTML_TEMPORARYREDIRECT:
result := true;
else
result := false;
end;
end;
Also, if anybody has experience with serving audio files to Safari, advice and suggestions would be helpful. I'm sure I'm missing either a status code or header, but serving the audio files through mormot works with all the browsers except Safari, which sees it as a live broadcast.
Offline
Please check http://synopse.info/fossil/info/a85d5104b5
Online
Looks perfect. Thanks!
Offline
From the HTTP POV all status codes >= 200 and <300 is a success status codes. So, may be do in this way (at last such realization is used in all browser-side frameworks):
function StatusCodeIsSuccess(Code: integer): boolean;
begin
Result := (Code >= HTTP_SUCCESS) and (Code < HTTP_MULTIPLECHOICES);
end;
This is a Angular1 success function:
function isSuccess(status) {
return 200 <= status && status < 300;
}
Last edited by mpv (2016-08-26 11:23:05)
Offline
Yes, from the Delphi POV 300...307 is a success. I miss it, because from browser side I never got this responses in the JavaScript XHR - it handled by browser on the low level. So, the final propose is:
function StatusCodeIsSuccess(Code: integer): boolean;
begin
Result := (Code >= HTTP_SUCCESS) and (Code <= HTTP_TEMPORARYREDIRECT);
end;
Is it OK?
Last edited by mpv (2016-08-27 10:52:45)
Offline
Pages: 1