Skip to content

Commit b0cccd8

Browse files
committed
提交整个json内容时,也验证用户
1 parent e5cef61 commit b0cccd8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cetty-craft/src/cetty/craft/http/ServiceRequestMapping.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,19 @@ bool ServiceRequestMapping::parseMessage(const HttpRequestPtr& request,
352352
}
353353
}
354354
else if (messageOptions.mapping_content()) {
355+
//parse authority first
356+
int fieldCnt = descriptor->field_count();
357+
for (int i = 0; i < fieldCnt; ++i) {
358+
const google::protobuf::FieldDescriptor* field = descriptor->field(i);
359+
if (field->name().compare("authority") == 0) {
360+
Message* authority = reflection->MutableMessage(message, field);
361+
if (dynamic_cast<Authority*>(authority)) {
362+
parseMessage(request, method, authority);
363+
}
364+
}
365+
}
366+
367+
//parse the content
355368
int size;
356369
const char* bytes = request->content()->readableBytes(&size);
357370

0 commit comments

Comments
 (0)