Skip to content

Commit fd57674

Browse files
authored
Merge pull request #16 from WKJay/master
修复问题,增加对不同浏览器的支持
2 parents b89cb6e + 1de2ae8 commit fd57674

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/wn_module.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ int webnet_module_system_dofile(struct webnet_session *session)
153153

154154
#if WEBNET_CACHE_LEVEL > 0
155155
char ctime_str[32];
156+
char gmtime_str[32];
157+
struct tm* info;
156158
int stat_result = -1;
157159
#endif /* WEBNET_CACHE_LEVEL */
158160

@@ -204,13 +206,18 @@ int webnet_module_system_dofile(struct webnet_session *session)
204206
if (stat_result == 0)
205207
{
206208
rt_enter_critical();
209+
info = localtime((time_t *)&file_stat.st_mtime);
210+
memset(gmtime_str,0,32);
211+
strftime(gmtime_str,sizeof(ctime_str),"%a, %d %b %Y %H:%M:%S GMT",info);
212+
207213
strcpy(ctime_str, ctime((time_t *)&file_stat.st_mtime));
208214
rt_exit_critical();
209215

210216
ctime_str[strlen(ctime_str) - 1] = '\0'; /* clear the end \n */
217+
gmtime_str[strlen(gmtime_str)] = '\0'; /* clear the end \n */
211218

212219
if ((request->modified != RT_NULL)
213-
&& (strcmp(request->modified, ctime_str) == 0))
220+
&& ((strcmp(request->modified, ctime_str) == 0)||strcmp(request->modified, gmtime_str) == 0))
214221
{
215222
request->result_code = 304;
216223
return WEBNET_MODULE_FINISHED;

src/wn_request.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ const char* webnet_request_get_query(struct webnet_request* request, char* name)
180180

181181
for (index = 0; index < request->query_counter; index ++)
182182
{
183-
if (strncmp(request->query_items[index].name, name, strlen(name)) == 0)
183+
if (strncmp(request->query_items[index].name, name, strlen(name)) == 0 &&
184+
strlen(name) == strlen(request->query_items[index].name))
184185
return request->query_items[index].value;
185186
}
186187

0 commit comments

Comments
 (0)