democlient: skip the leading 'code='. output warnings in the log.
This commit is contained in:
parent
e8182395f7
commit
9f41fcfbcb
|
@ -44,7 +44,15 @@ public:
|
|||
|
||||
void reportOut(const std::string &outmsg) { }
|
||||
void reportErr(const ErrorLogger::ErrorMessage &msg) {
|
||||
printf("%s\n", msg.toString(true).c_str());
|
||||
const std::string s = msg.toString(true);
|
||||
|
||||
printf("%s\n", s.c_str());
|
||||
|
||||
FILE *logfile = fopen("democlient.log", "at");
|
||||
if (logfile != NULL) {
|
||||
fprintf(logfile, "%s\n", s.c_str());
|
||||
fclose(logfile);
|
||||
}
|
||||
}
|
||||
|
||||
void reportProgress(const
|
||||
|
@ -76,15 +84,19 @@ int main()
|
|||
fgets(data, len, stdin);
|
||||
}
|
||||
|
||||
char code[4096] = {0};
|
||||
unencode(data, code);
|
||||
|
||||
if (strlen(code) > 1000) {
|
||||
if (data[4000] != '\0') {
|
||||
puts("Content-type: text/html\r\n\r\n");
|
||||
puts("<html><body>For performance reasons the code must be shorter than 1000 chars.</body></html>");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
const char *pdata = data;
|
||||
if (std::strncmp(pdata, "code=", 5)==0)
|
||||
pdata += 5;
|
||||
|
||||
char code[4096] = {0};
|
||||
unencode(pdata, code);
|
||||
|
||||
FILE *logfile = fopen("democlient.log", "at");
|
||||
if (logfile != NULL) {
|
||||
fprintf(logfile, "===========================================================\n%s\n", code);
|
||||
|
|
Loading…
Reference in New Issue