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 (_, version) = strings::cut(version, "/");
|
||||||
const (major, minor) = strings::cut(version, ".");
|
const (major, minor) = strings::cut(version, ".");
|
||||||
resp.version = (
|
|
||||||
strconv::stou(major)!,
|
const major = match (strconv::stou(major)) {
|
||||||
strconv::stou(minor)!,
|
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) {
|
if (resp.version.0 > 1) {
|
||||||
return errors::unsupported;
|
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);
|
resp.reason = strings::dup(reason);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue