Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on: [push,pull_request]

jobs:
win:
strategy:
fail-fast: false
max-parallel: 2
matrix:
include: [
{msystem: MINGW32, toolchain: mingw-w64-i686, version: x32 },
{msystem: MINGW64, toolchain: mingw-w64-x86_64, version: x64 },
]
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Install msys2 build environment
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: false
install: base-devel git ${{ matrix.toolchain }}-toolchain upx

- run: git config --global core.autocrlf input
shell: bash

- uses: actions/checkout@v2

- name: Build plugin
shell: msys2 {0}
run: |
make
upx miniweb.exe

- uses: actions/upload-artifact@v2
with:
name: miniweb_${{ matrix.version }}
path: |
./miniweb.exe
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.o
*.exe
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DEFINES=

ifdef WINDIR
DEFINES+= -DWIN32
LDADD += -lws2_32 -lshell32 -liphlpapi
LDADD += -lws2_32 -lshell32 -liphlpapi -s
OS="Win32"
else
#CFLAGS+= -fPIC
Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,39 @@ See [License note](./miniweb-avih/LICENSE.md).
based is at branch `svn-orig-rev-208` of this repository (the original project seems
unmaintained since 2013.).


## Building on Windows with msys2

```shell
pacman -S mingw-w64-x86_64-toolchain upx # And press enter to install all
msys2 -mingw64 # Start msys2 with path to use mingw64
make
upx miniweb.exe # Optional, compress the exe file
```

## Adding a new MIME type

In httpint.h:55 section, add your new file extension:
```c
#define FILEEXT_SVG DEFDWORD('S', 'V', 'G', 0)
```

In http.c:2269 section, add the mapping between the new file extension and the offset of the filetype:
```c
case FILEEXT_SVG: return HTTPFILETYPE_SVG;
```

In httpapi.h:56 section add the new offset at the end of enum:
```c
HTTPFILETYPE_SVG,
```

In http.c:76 section add your new MIME type at the end of the table, to match exactly the same position as the entry in the above enum:
```c
"image/svg+xml",
```


### [Original project description below]

## MiniWeb
Expand Down
2 changes: 2 additions & 0 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const char* contentTypeTable[]={
"application/x-mpegURL",
"application/sdp",
"application/binhex",
"image/svg+xml",
};

char* defaultPages[]={"index.htm","index.html","default.htm","main.xul"};
Expand Down Expand Up @@ -2286,6 +2287,7 @@ int mwGetContentType(const char *pchExtname)
case FILEEXT_3GP: return HTTPFILETYPE_3GP;
case FILEEXT_ASF: return HTTPFILETYPE_ASF;
case FILEEXT_SDP: return HTTPFILETYPE_SDP;
case FILEEXT_SVG: return HTTPFILETYPE_SVG;
}
} else if (pchExtname[4]=='\0' || pchExtname[4]=='?') {
memcpy(&dwExt, pchExtname, sizeof(dwExt));
Expand Down
1 change: 1 addition & 0 deletions httpapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef enum {
HTTPFILETYPE_M3U8,
HTTPFILETYPE_SDP,
HTTPFILETYPE_HEX,
HTTPFILETYPE_SVG,
} HttpFileType;

#define MAXPOSTPARAMS 50
Expand Down
1 change: 1 addition & 0 deletions httpint.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#define FILEEXT_TS DEFDWORD('T', 'S', 0, 0)
#define FILEEXT_M3U8 DEFDWORD('M', '3' - 32, 'U', '8' - 32)
#define FILEEXT_SDP DEFDWORD('S', 'D', 'P', 0)
#define FILEEXT_SVG DEFDWORD('S', 'V', 'G', 0)

// Settings for http server
#define HTTP_EXPIRATION_TIME (120/*secs*/)
Expand Down