Skip to content

Commit

Permalink
Merge pull request #7897 from thess/localhost-debug-fix
Browse files Browse the repository at this point in the history
Fix web-editor debug on non-standard port using localhost (CORS)
  • Loading branch information
tannewt authored Apr 24, 2023
2 parents d078bc3 + ccbb6a5 commit 029c941
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion supervisor/shared/web_workflow/web_workflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,12 @@ static bool _origin_ok(_request *request) {
return true;
}
// DEBUG: OK if origin is 'localhost' (ignoring port #)
*strchrnul(&request->origin[PREFIX_HTTP_LEN], ':') = '\0';
char *cptr = strchrnul(&request->origin[PREFIX_HTTP_LEN], ':');
char csave = *cptr; // NULL or colon
*cptr = '\0';
if (strcmp(&request->origin[PREFIX_HTTP_LEN], "localhost") == 0) {
// Restore removed colon if non-null host terminator
*cptr = csave;
return true;
}
}
Expand Down

0 comments on commit 029c941

Please sign in to comment.