Check-in [fc316cfcdd]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix lookup mime type
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fc316cfcddc0979887230054fb202c5214863648
User & Date: dsx 2014-09-13 09:24:21
Context
2014-09-15
17:24
include & mime type check-in: 5c91ab12fe user: dsx tags: trunk
2014-09-13
09:24
fix lookup mime type check-in: fc316cfcdd user: dsx tags: trunk
09:23
fix parse mime type check-in: c5478a987a user: dsx tags: trunk
Changes

Changes to main.c.

436
437
438
439
440
441
442


443



444
445
446
447


448
449




450
451
452
453
454

455
456
457
458
459
460
461
	return NULL;
}

static const char *
content_type_lookup(const char *filepath)
{
	struct mohawk_hash *mime_type;


	char *ext = strrchr(filepath, '.');




	if (ext != NULL) {
		ext++;
		if (ext != '\0') {


			SLIST_FOREACH(mime_type, &conf.mime_type, entry) {
				if (strcasecmp(ext, mime_type->key) == 0)




					return mime_type->value;
			}
		}
	}


	return "application/octet-stream";
}

static struct vhost *
find_location(struct vhost *vhost, struct mohawk_path *paths)
{
	struct vhost *vh;







>
>
|
>
>
>

<
|
|
>
>
|
<
>
>
>
>
|
|
|
<
<
>







436
437
438
439
440
441
442
443
444
445
446
447
448
449

450
451
452
453
454

455
456
457
458
459
460
461


462
463
464
465
466
467
468
469
	return NULL;
}

static const char *
content_type_lookup(const char *filepath)
{
	struct mohawk_hash *mime_type;
	char *ext, *slash;

	if ((slash = strrchr(filepath, '/')) == NULL)
		goto done;
	if ((ext = strrchr(slash, '.')) == NULL)
		goto done;


	ext++;
	if (ext == '\0')
		goto done;

	SLIST_FOREACH(mime_type, &conf.mime_type, entry) {

#ifdef USE_DEBUG
		fprintf(stderr, "Debug: search '%s' in '%s'\n", ext, mime_type->value);
#endif
		if (strcasestr(mime_type->value, ext) != NULL)
			return mime_type->key;
	}



done:
	return "application/octet-stream";
}

static struct vhost *
find_location(struct vhost *vhost, struct mohawk_path *paths)
{
	struct vhost *vh;