Commit 77d2ff05 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Sets the server response code.

Detail:
  The Status SWI should be returning the server response code in R2,
    but is always returning 0 because it never bothers to parse the
    top header in the response.  This is now done.
Admin:
  Reported by gerph.
  Tested.

Version 0.89. Tagged as 'HTTP-0_89'
parent 58580627
/* (0.88)
/* (0.89)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.88
#define Module_MajorVersion_CMHG 0.89
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Nov 2000
#define Module_Date_CMHG 07 Feb 2001
#define Module_MajorVersion "0.88"
#define Module_Version 88
#define Module_MajorVersion "0.89"
#define Module_Version 89
#define Module_MinorVersion ""
#define Module_Date "01 Nov 2000"
#define Module_Date "07 Feb 2001"
#define Module_ApplicationDate2 "01-Nov-00"
#define Module_ApplicationDate4 "01-Nov-2000"
#define Module_ApplicationDate2 "07-Feb-01"
#define Module_ApplicationDate4 "07-Feb-2001"
#define Module_ComponentName "HTTP"
#define Module_ComponentPath "RiscOS/Sources/Networking/Fetchers/HTTP"
#define Module_FullVersion "0.88"
#define Module_HelpVersion "0.88 (01 Nov 2000)"
#define Module_FullVersion "0.89"
#define Module_HelpVersion "0.89 (07 Feb 2001)"
......@@ -452,10 +452,19 @@ int parse_http_header(char *const buffer, int buflen, Session *ses, _kernel_swi_
if (!http_match && (buffer[4] == '/' || broken_ncsa)) {
/* Fine. We just have to hope we've not been fooled */
char *response_code = buffer + 4;
while (!isspace(*response_code)) ++response_code;
while (*response_code && isspace(*response_code)) ++response_code;
ses->server_code = (int) strtoul(response_code, &response_code, 10);
if (*response_code && !isspace(*response_code)) {
/* Oh dear - badly formed first header :-/ */
}
}
else {
/* Not fine. HTTP/0.9 response. Need to fake a few things now */
ses->read_status = 200;
ses->server_code = 200;
http_add_header(&ses->headers, "HTTP/1.0", "200 " Module_Title " guessing OK");
http_add_header(&ses->headers, "Warning", "99 Server didn't sent any headers");
http_add_header(&ses->headers, "Content-Type", "text/html");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment