Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit709042a

Browse files
p0pr0ck5zimmerle
authored andcommitted
Don't unnecessarily rename request body parts in cleanup
When tmp_dir and upload_dir are identical, there's no reason torename multipart and request body parts, as this is a non-op. Let'ssave the cycles and syscall.
1 parent8559dd3 commit709042a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎apache2/msc_multipart.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,11 @@ apr_status_t multipart_cleanup(modsec_rec *msr) {
13271327
}else {
13281328
/* Move file to the upload dir. */
13291329
if (parts[i]->tmp_file_name!=NULL) {
1330+
if (strcmp(msr->txcfg->upload_dir,msr->txcfg->tmp_dir)==0) {
1331+
msr_log(msr,4,"Not moving part to identical location");
1332+
continue;
1333+
}
1334+
13301335
constchar*new_filename=NULL;
13311336
constchar*new_basename=NULL;
13321337

‎apache2/msc_reqbody.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,11 @@ apr_status_t modsecurity_request_body_clear(modsec_rec *msr, char **error_msg) {
884884

885885
if (msr->msc_reqbody_filename!=NULL) {
886886
if (keep_body) {
887+
if (strcmp(msr->txcfg->upload_dir,msr->txcfg->tmp_dir)==0) {
888+
msr_log(msr,4,"Not moving file to identical location.");
889+
gotonullify;
890+
}
891+
887892
/* Move request body (which is a file) to the storage area. */
888893
constchar*put_filename=NULL;
889894
constchar*put_basename=NULL;
@@ -933,6 +938,8 @@ apr_status_t modsecurity_request_body_clear(modsec_rec *msr, char **error_msg) {
933938
msr->msc_reqbody_filename);
934939
}
935940

941+
nullify:
942+
936943
msr->msc_reqbody_filename=NULL;
937944
}
938945
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp