http::do: handle more protoerror cases
This commit is contained in:
parent
dbeb079262
commit
159dd0d06f
|
@ -100,15 +100,31 @@ fn read_statusline(
|
|||
|
||||
const (_, version) = strings::cut(version, "/");
|
||||
const (major, minor) = strings::cut(version, ".");
|
||||
resp.version = (
|
||||
strconv::stou(major)!,
|
||||
strconv::stou(minor)!,
|
||||
);
|
||||
|
||||
const major = match (strconv::stou(major)) {
|
||||
case let u: uint =>
|
||||
yield u;
|
||||
case =>
|
||||
return protoerr;
|
||||
};
|
||||
const minor = match (strconv::stou(minor)) {
|
||||
case let u: uint =>
|
||||
yield u;
|
||||
case =>
|
||||
return protoerr;
|
||||
};
|
||||
resp.version = (major, minor);
|
||||
|
||||
if (resp.version.0 > 1) {
|
||||
return errors::unsupported;
|
||||
};
|
||||
|
||||
resp.status = strconv::stou(status)!;
|
||||
resp.status = match (strconv::stou(status)) {
|
||||
case let u: uint =>
|
||||
yield u;
|
||||
case =>
|
||||
return protoerr;
|
||||
};
|
||||
|
||||
resp.reason = strings::dup(reason);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue