Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
a9a5c0b8
Commit
a9a5c0b8
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Deuce's fixes for check_request and send_error.
parent
8ddbf6ac
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/websrvr.c
+10
-9
10 additions, 9 deletions
src/sbbs3/websrvr.c
with
10 additions
and
9 deletions
src/sbbs3/websrvr.c
+
10
−
9
View file @
a9a5c0b8
...
@@ -502,6 +502,7 @@ static const char* get_mime_type(char *ext)
...
@@ -502,6 +502,7 @@ static const char* get_mime_type(char *ext)
{
{
uint
i
;
uint
i
;
lprintf
(
"Getting mime-type for %s"
,
ext
);
if
(
ext
==
NULL
)
if
(
ext
==
NULL
)
return
(
unknown_mime_type
);
return
(
unknown_mime_type
);
...
@@ -561,6 +562,7 @@ BOOL send_headers(http_session_t *session, const char *status)
...
@@ -561,6 +562,7 @@ BOOL send_headers(http_session_t *session, const char *status)
}
}
if
(
!
ret
)
{
if
(
!
ret
)
{
sockprintf
(
session
->
socket
,
"%s: %d"
,
get_header
(
HEAD_LENGTH
),
stats
.
st_size
);
sockprintf
(
session
->
socket
,
"%s: %d"
,
get_header
(
HEAD_LENGTH
),
stats
.
st_size
);
lprintf
(
"%04d Sending stats for: %s"
,
session
->
socket
,
session
->
req
.
request
);
sockprintf
(
session
->
socket
,
"%s: %s"
,
get_header
(
HEAD_TYPE
)
sockprintf
(
session
->
socket
,
"%s: %s"
,
get_header
(
HEAD_TYPE
)
,
get_mime_type
(
strrchr
(
session
->
req
.
request
,
'.'
)));
,
get_mime_type
(
strrchr
(
session
->
req
.
request
,
'.'
)));
...
@@ -589,15 +591,14 @@ static void sock_sendfile(SOCKET socket,char *path)
...
@@ -589,15 +591,14 @@ static void sock_sendfile(SOCKET socket,char *path)
static
void
send_error
(
char
*
message
,
http_session_t
*
session
)
static
void
send_error
(
char
*
message
,
http_session_t
*
session
)
{
{
char
error_path
[
MAX_PATH
+
1
];
char
error_code
[
4
];
char
error_code
[
4
];
session
->
req
.
send_location
=
FALSE
;
session
->
req
.
send_location
=
FALSE
;
SAFECOPY
(
error_code
,
message
);
sprintf
(
session
->
req
.
request
,
"%s%s.html"
,
error_dir
,
error_code
);
if
(
session
->
http_ver
>
HTTP_0_9
)
if
(
session
->
http_ver
>
HTTP_0_9
)
send_headers
(
session
,
message
);
send_headers
(
session
,
message
);
SAFECOPY
(
error_code
,
message
);
sock_sendfile
(
session
->
socket
,
session
->
req
.
request
);
sprintf
(
error_path
,
"%s%s.html"
,
error_dir
,
error_code
);
sock_sendfile
(
session
->
socket
,
error_path
);
close_request
(
session
);
close_request
(
session
);
}
}
...
@@ -955,8 +956,11 @@ static BOOL check_request(http_session_t * session)
...
@@ -955,8 +956,11 @@ static BOOL check_request(http_session_t * session)
return
(
FALSE
);
return
(
FALSE
);
}
}
if
(
!
fexist
(
path
))
{
if
(
!
fexist
(
path
))
{
backslash
(
path
);
if
(
path
[
strlen
(
path
)
-
1
]
!=
'/'
)
{
strcat
(
path
,
"/"
);
}
strcat
(
path
,
startup
->
index_file_name
);
strcat
(
path
,
startup
->
index_file_name
);
session
->
req
.
send_location
=
TRUE
;
}
}
if
(
strnicmp
(
path
,
root_dir
,
strlen
(
root_dir
)))
{
if
(
strnicmp
(
path
,
root_dir
,
strlen
(
root_dir
)))
{
lprintf
(
"%04d path = '%s'"
,
session
->
socket
,
path
);
lprintf
(
"%04d path = '%s'"
,
session
->
socket
,
path
);
...
@@ -969,10 +973,7 @@ static BOOL check_request(http_session_t * session)
...
@@ -969,10 +973,7 @@ static BOOL check_request(http_session_t * session)
send_error
(
"404 Not Found"
,
session
);
send_error
(
"404 Not Found"
,
session
);
return
(
FALSE
);
return
(
FALSE
);
}
}
if
(
strcmp
(
path
,
session
->
req
.
request
))
{
SAFECOPY
(
session
->
req
.
request
,
path
);
session
->
req
.
send_location
=
TRUE
;
SAFECOPY
(
session
->
req
.
request
,
path
);
}
/* Set default ARS to a 0-length string */
/* Set default ARS to a 0-length string */
session
->
req
.
ars
[
0
]
=
0
;
session
->
req
.
ars
[
0
]
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment