Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic directory listing fixing #32. Added 301 responses. #35

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
569ab3c
Initial Commit
nemasu Jan 27, 2014
5331a94
Update README.md
nemasu Jan 28, 2014
02b2d82
Update README.md
nemasu Jan 28, 2014
8006773
Update README.md
nemasu Jan 28, 2014
5720170
Version 0.02 Commit
nemasu Jan 28, 2014
488d1e9
Merge branch 'master' of github.com:nemasu/asmttpd
nemasu Jan 28, 2014
0755083
Update README.md
nemasu Jan 30, 2014
b7e196c
Fixed SIGBUS problem on recv of 0 bytes.
nemasu Jan 30, 2014
855661f
Added 206 response with file splitting.
nemasu Feb 1, 2014
411672a
Version 0.04 - Added large file http streams in 200 responses.
nemasu Feb 3, 2014
5a27202
README formated.
Feb 3, 2014
93c758c
.gitignore added.
Feb 3, 2014
2928f74
sudo needed.
Feb 3, 2014
ffaebd6
Merge pull request #3 from TheFox/readme
nemasu Feb 3, 2014
c0feecf
Hello World added.
Feb 3, 2014
34d31ac
Merge pull request #4 from TheFox/hello-world
nemasu Feb 3, 2014
855f479
0.05 - Changed to sendfile, got rid of buffer.
nemasu Feb 4, 2014
82f2ff8
0.06 - Worker thread stack corruption bug fixed.
nemasu Feb 4, 2014
98fa007
0.07 - Removed thread pool, changed to an accept-per-thread model.
nemasu Feb 4, 2014
7d6e251
Update README.md
nemasu Feb 4, 2014
e43b070
0.08 Added TCP corking.
nemasu Feb 4, 2014
d2b7037
Merge branch 'master' of github.com:nemasu/asmttpd
nemasu Feb 4, 2014
38fb498
0.09 - Issue #8 fix. Crashes on long request paths.
nemasu Feb 5, 2014
21abac1
Update debug.asm
nemasu Feb 5, 2014
3e542cc
Update main.asm
nemasu Feb 5, 2014
8a30391
Update string.asm
nemasu Feb 5, 2014
374f54c
asmttpd - 0.1
nemasu Feb 6, 2014
6758a82
0.1.1
nemasu Feb 7, 2014
17ce395
0.2
nemasu Feb 10, 2014
ce36fba
Update README.md
nemasu Feb 10, 2014
64d751e
Update msg_bind_error
Cir0X Apr 11, 2014
6f7f890
Merge pull request #12 from Cir0X/master
nemasu Apr 12, 2014
f758aaf
-Added default document
nemasu Jul 14, 2014
acb4866
cleanup
nemasu Jul 14, 2014
2d64826
Update README.md
nemasu Jan 20, 2015
61ddcdd
Fix typos
xairy May 20, 2015
05f8e54
First commit of fasm version
triforce Oct 27, 2015
addfce8
Merge pull request #19 from triforce/fasm
nemasu Oct 28, 2015
7b04c11
Revert "First commit of fasm version"
nemasu Oct 28, 2015
9ab37b2
Merge pull request #20 from nemasu/revert-19-fasm
nemasu Oct 28, 2015
77905cb
Fixed http_404_text_len constant reference
triforce Oct 29, 2015
e98cf15
Merge pull request #22 from triforce/master
nemasu Oct 29, 2015
9843b1a
Ref #23 Branch for development of HEAD request. Initial commit of imp…
triforce Jul 9, 2016
0b4eb6c
Update main.asm
triforce Jul 11, 2016
5b7a45d
Merge pull request #24 from triforce/headrequest
nemasu Jul 12, 2016
9fd96ce
Fixes #17 - Calculate request type length when testing for document …
triforce Oct 29, 2016
06dec84
Merge pull request #26 from triforce/fix_head_request
nemasu Oct 31, 2016
67c8719
Update README.md
nemasu Oct 31, 2016
af5b69e
version 0.4 - HEAD support
nemasu Oct 31, 2016
70f483b
Version 0.41 - fix issue 30
nemasu Oct 17, 2017
3205ebf
Fix version
nemasu Oct 17, 2017
205e6a5
Version 0.4.2 - Set REUSEADDR.
nemasu Oct 18, 2017
a0047b5
Fixed typos in label names: repsonse/response
triforce Oct 19, 2017
b5addaf
Merge pull request #33 from triforce/fixed_response_typos
nemasu Oct 20, 2017
3761d35
Added basic directory listing and 301 responses fixing #32.
triforce Nov 3, 2017
ffd2b1c
Merge remote-tracking branch 'upstream/master' into add_dir_listing
triforce Nov 3, 2017
2dab68c
Changed back to listen on port 80 by default.
triforce Nov 3, 2017
50ecec6
Fixed bug causing regular non extension files being treated as direct…
triforce Dec 5, 2017
3309cb0
Custom port.
nemasu Jan 18, 2019
be6154f
Custom port.
nemasu Jan 24, 2019
d5d1e85
Custom port.
nemasu Jan 24, 2019
3983a4b
README
nemasu Jan 24, 2019
41eef9a
Merge pull request #43 from nemasu/custom_port
nemasu Jan 24, 2019
d04a89d
README
nemasu Jan 24, 2019
ec0daa1
svg support
nemasu Apr 22, 2019
167cfda
readme
nemasu Apr 22, 2019
079b329
Merge branch 'master' into add_dir_listing
triforce Jun 25, 2019
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
Prev Previous commit
Next Next commit
Added 206 response with file splitting.
  • Loading branch information
nemasu committed Feb 1, 2014
commit 855661f1e8049ab017a3312f225510fb2429fa56
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ Features:

What works:
* Serving files from specified document root.
* 200 for < ~10MB files
* 206 for > ~10MB files. File is split and supports Content-Range header.
* 404 if file not found.
* Content-types: xml, html, xhtml, gif, png, jpeg, css, and js.

Planned Features:
* Directory listing.

Limitations being worked on:
Current Limitations / Known Issues
=======
* Files are not read in chuncks, attempting to tranfer a large file will not work.


* Most clients do not use 206 to recieve large files. Need to improve 200 to continuously stream data.

Installation
=======

Expand All @@ -36,6 +39,11 @@ Usage

Changes
=======
2014-02-01 : asmttpd - 0.03

* Files are split if too large to fit into buffer.
* Added 206 responses with Content-Range handling


2014-01-30 : asmttpd - 0.02

Expand Down
16 changes: 15 additions & 1 deletion constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
%define THREAD_BUFFER_SIZE 11534336 ; 11MB local thread storage. 10 MB for file buffer, 1MB for request. Buffer: start [ HTTP-Request,HTTP-Response,File-Data ] end
; File portion will be reduced incase of large HTTP-Requests.

%define HEADER_RESERVED_SIZE 1048576 ; 1MB
;Flags
%define MMAP_PROT_READ 0x1
%define MMAP_PROT_WRITE 0x2
Expand All @@ -51,11 +52,24 @@
%define SOCK_STREAM 1
%define PROTO_TCP 6

;%define RECV_WAITALL 0x100
%define LSEEK_SET 0 ; seek to offset bytes
%define LSEEK_END 2 ; seek to end plus offset

;Internal Constants
%define CONTENT_TYPE_HTML 0
%define CONTENT_TYPE_OCTET_STREAM 1
%define CONTENT_TYPE_CSS 2
%define CONTENT_TYPE_JAVASCRIPT 3
%define CONTENT_TYPE_XHTML 4
%define CONTENT_TYPE_XML 5
%define CONTENT_TYPE_GIF 6
%define CONTENT_TYPE_PNG 7
%define CONTENT_TYPE_JPEG 8

;System Call Values
%define SYS_READ 0 ;int fd, const void *buf, size_t count
%define SYS_WRITE 1 ;int fd, const void *buf, size_t count
%define SYS_LSEEK 8 ;int fd, off_t offset, int whence
%define SYS_MMAP 9 ;void *addr, size_t length, int prot, int flags, int fd, off_t offset
%define SYS_CLONE 56 ;unsigned long clone_flags, unsigned long newsp, void ___user *parent_tid, void __user *child_tid, struct pt_regs *regs
%define SYS_EXIT 60 ;int status
Expand Down
30 changes: 26 additions & 4 deletions data.asm
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,50 @@
msg_using_directory_len equ $ - msg_using_directory
msg_not_a_directory dd "Error: Specified document root is not a directory",0x00
msg_not_a_directory_len equ $ - msg_not_a_directory
msg_request_log dd 0x0a,"Request: ",0x00
msg_request_log db 0x0a,"Request: ",0x00
msg_request_log_len equ $ - msg_request_log

header_range_search db "Range: ",0x00
header_range_search_len equ $ - header_range_search

filter_test db "/home/nemasu/../something",0x00
filter_test_len equ $ - filter_test

find_bytes_range db "bytes=",0x00
find_bytes_range_len equ $ - find_bytes_range
filter_prev_dir db "../",0x00
filter_prev_dir_len equ $ - filter_prev_dir

crlfx2 db 0x0d,0x0a,0x0d,0x0a,0x00
crlfx2_len equ $ - crlfx2

crlf db 0x0d,0x0a,0x00
crlf_len equ $ - crlf

char_slash db "/",0x00
char_hyphen db "-",0x00

;HTTP
;need 413-toolarge 416-rangesucks

http_200 db "HTTP/1.1 200 OK",0x0d,0x0a,0x00
http_200_len equ $ - http_200
http_206 db "HTTP/1.1 206 Partial Content",0x0d,0x0a,0x00
http_206_len equ $ - http_206
http_404 db "HTTP/1.1 404 Not Found",0x0d,0x0a,0x00
http_404_len equ $ - http_404
http_404_text db "I'm sorry, Dave. I'm afraid I can't do that. 404 Not Found",0x00
http_404_text_len equ $ - http_404_text_len
server_header db "Server: asmttpd/",ASMTTPD_VERSION,0x0d,0x0a,0x00
server_header_len equ $ - server_header

range_header db "Accept-Ranges: bytes",0x0d,0x0a,0x00
range_header_len equ $ - range_header

content_range db "Content-Range: bytes ",0x00
content_range_len equ $ - content_range ;Content-Range: bytes 200-1000/3000

content_length db "Content-Length: ",0x00 ;Content-Length: 800
content_length_len equ $ - content_length

connection_header db "Connection: close",0x0d,0x0a,0x00
connection_header_len equ $ - connection_header

Expand Down
Loading