GithubHelp home page GithubHelp logo

prajjwaldatir / http-prajjwal Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 2.45 MB

HTTP protocol implemented as per RFC using SOCKET programming in python

Python 90.48% HTML 4.79% Shell 1.51% C++ 3.22%
http-protocol rfc socket-programming python3 http-server

http-prajjwal's Introduction

HTTP Webserver From Scratch

Implemented RFC of HTTP using SOCKET programming in python3

Download this and store it into your home directory such that, This should be your path

/home/maniac/HTTP-Prajjwal/

HOW TO RUN

main file cotaining the code => httpserver.py

To run main file with restart,start, quit functionality running in SEPARATE window

bash master.sh

To run main file with restart,start, quit functionality running in SAME window

python3 master.py port_number

To Test the program Run

python3 testing/autoTest.py 5562

HTTP-Web-Server

This is the project based on http protocol that has been used in day to day life. All dimensions are considered according to rfc 2616

It has following features:-

HTTP: GET, POST, PUT, HEAD, DELETE, Cookies, Headers, non-persistent connections, Multiple clients at the same time (with a sepearate program to test this), logging with levels of logging, handling file permissions; Server configuration config file with DocumentRoot, log file name, max simulateneous connections ; way to stop and restart the server;

It is developed using socket programming and very basic level of python. Project Developer has only focused on the quality of the server and not the features of the python language.

Those having beginner level of knowledge about socket Programming and Python language are requested to see and understand the code as the developer also has the beginner level of knowledge in both

Minimum Expectations from Projects

For all projects, the commands should follow unix conventions. 
That is, the use of hyphenated options (e.g. ls -a)  and 
arguments on the command line (e.g. ls /tmp/) should be supported. 
The default behavior of each software should be like the existing tools.

HTTP Server
Reference: https://tools.ietf.org/html/rfc2616
GET, POST, PUT, HEAD, DELETE, Cookies, Headers, non-persistent connections, 
Multiple clients at the same time (with a sepearate program to test this), 
logging with levels of logging, handling file permissions;  
Server configuration - config file with DocumentRoot, log file name, max simulateneous connections; 
way to stop and restart the server;

Marks : Basic HTTP 5 method = 15 marks; MT = 3 marks; 
Config file and handling = 3 marks; cookies = 2 marks; log = 3 marks;  
file permissions = 1 marks; Automated Testing = 3 marks.

Here's PseudoCode I refered to while building HTTP server.

webserver {
	open a socket, bind to port 90
	listen
	t = accept();
	create a thread for t
	thread {
		s -> socket to exchange data for this particular connection
		loop {
			d = recvdata();
			interprete the data in d; // headers are to be deciphered
				string processing, tokenizing, making sense of data
				loop {
					l = next line();
					t = ':' separated list of tokens from l;
					swithch(t) {
						"Host": do something;
							carry some action on the server side;
							change some headers in the output (sent to browser);
						"User-Agent": do something;
						"GET":
							f = get the next part of "GET" // filename;
							open f;
							write HTTP headers into the socket;
							dump file f() into the socket;
						"if-modified-since":
							ht = get the 'time' given in header;
							ct = get current time;
							ft = get the time when file was modified;
							if(ft - ct < ht)
								just send headers in socket
							else
								send headers + file in socket;	
					}
				}	
		}	
	}
}
  • Special Thanks to Abhijit Sir ( COEP CS Faculty)
  • RFC
  • Mozilla HTTP Docs
  • TutorialsPoint
  • Seniors and peers for helping me out throughout the project.

http-prajjwal's People

Contributors

prajjwaldatir avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.