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

updating partial-send/recv #43

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2390d2c
build(CGI Folder):parse simple structuerto implement cgi
hashimtop Feb 23, 2024
54f7943
Merge branch 'CGI-Parser' of github.com:samih713/webserv into CGI-Parser
hashimMH Feb 29, 2024
d4f8665
test(CGI main): remembering execve
hashimMH Feb 29, 2024
16e9ccf
build(CGI):implement ecxute fun for cgi
hashimMH Mar 4, 2024
fb22254
build(cgi.cpp):save the res into string
hashimMH Mar 6, 2024
cbcd27c
Fix(Cgi.cpp):save the res into a file
hashimMH Mar 7, 2024
d072ccf
build(CGI Folder):parse simple structuerto implement cgi
hashimtop Feb 23, 2024
bbc3270
test(CGI main): remembering execve
hashimMH Feb 29, 2024
832769f
build(CGI):implement ecxute fun for cgi
hashimMH Mar 4, 2024
89462db
build(cgi.cpp):save the res into string
hashimMH Mar 6, 2024
3410b7a
Fix(Cgi.cpp):save the res into a file
hashimMH Mar 7, 2024
03d71d6
Merge branch 'CGI-Parser' of github.com:samih713/webserv into CGI-Parser
hashimtop Mar 10, 2024
d3e9c67
Fix(CGI/Makefile):update makefile
hashimMH Mar 11, 2024
33aa66d
Fix(Main.cpp)update the file path
hashimtop Mar 13, 2024
e52c223
ERR(CGi/MAKEILE):need fix
hashimtop Mar 14, 2024
2adfeec
Fix(CGI/MaKefile):include libhttp.a
hashimtop Mar 14, 2024
40c4ce8
build(CGI.CPP):parce requist to excute file
hashimtop Mar 17, 2024
60216db
Merge branch 'main' of github.com:samih713/webserv into CGI-Parser
hashimtop Mar 18, 2024
dde1111
Build(cgi.cpp)adding the resource parcer.
hashimMH Mar 22, 2024
ce6d64a
main marge
hashimtop Apr 5, 2024
e6faa0f
Merge branch 'main' of github.com:samih713/webserv into CGI-Parser
hashimtop Apr 6, 2024
7e25cfb
fix(cgi:makefile):update makefile regarding the new updates
hashimtop Apr 6, 2024
c43143f
path fix
hashimtop Apr 7, 2024
6987017
chore(http/request/parse.cpp): changed name to parse_request.cpp
Taanviir Apr 11, 2024
56ab3a9
chore: removed std:: from runtime_error
Taanviir Apr 11, 2024
2f6f321
chore(ConfigParser.cpp): cleaned up formatting
Taanviir Apr 11, 2024
f82478e
build: updated clang-format
Taanviir Apr 12, 2024
0d35cc9
chore: updated .clang-format
Taanviir Apr 12, 2024
0d79de1
build: added format rule
Taanviir Apr 12, 2024
859c5b7
Merge branch 'main' of github.com:samih713/webserv into CGI-Parser
hashimtop Apr 15, 2024
8d3c265
build: Implemented CGI handling in common Makefile
Taanviir Apr 15, 2024
ab08fc9
build: added test_cgi to Makefile
Taanviir Apr 15, 2024
996092c
Fix(Cgi):merge main to cgi
hashimtop Apr 15, 2024
8f0a202
Merge pull request #40 from samih713/CGI-Parser
Taanviir Apr 15, 2024
54170da
chore: removed dSYM
Taanviir Apr 15, 2024
4b5d7c1
chore: added .dSYM to gitignore
Taanviir Apr 15, 2024
b7f373f
chore: added stds to .gitignore
Taanviir Apr 15, 2024
d309651
Merge branch 'kqueue' into main
Taanviir Apr 15, 2024
c3be072
action: compile check now occurs for all branches
Taanviir Apr 15, 2024
ec5eb21
action: compile check now occurs for all branches
Taanviir Apr 15, 2024
f86bc0c
feat(error-handling): added debug message macro
Taanviir Apr 15, 2024
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
97 changes: 61 additions & 36 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
---
BasedOnStyle: Mozilla
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
Enabled: false
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
Expand All @@ -48,38 +59,39 @@ AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: false
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterClass: false
AfterControlStatement: MultiLine
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterStruct: false
AfterUnion: false
AfterExternBlock: true
BeforeCatch: true
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakArrays: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: false
ColumnLimit: 90
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
Expand All @@ -89,16 +101,16 @@ Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeBlocks: Merge
IncludeCategories:
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
Priority: 2
Expand All @@ -114,7 +126,7 @@ IncludeCategories:
CaseSensitive: false
IncludeIsMainRegex: (Test)?$
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: true
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
Expand All @@ -135,7 +147,8 @@ IntegerLiteralSeparator:
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
Language: Cpp
LineEnding: DeriveLF
Expand All @@ -155,33 +168,37 @@ PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
QualifierAlignment: Leave
ReferenceAlignment: Pointer
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
RemoveBracesLLVM: false
RemoveBracesLLVM: true
RemoveParentheses: MultipleParentheses
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeInheritanceColon: false
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
Expand All @@ -190,22 +207,25 @@ SpaceBeforeParensOptions:
AfterFunctionDefinitionName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInParens: Never
SpacesInParensOptions:
InConditionalStatements: false
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
Expand All @@ -215,9 +235,14 @@ StatementMacros:
- QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInParentheses: false
5 changes: 1 addition & 4 deletions .github/workflows/compile-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Compilation Check
on:
push:
branches:
- main
- server/*
- handle_connection
- parsing
- '**'

jobs:
build-linux:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ test_socket
client
test_http
*.d
*.dSYM
stds
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@ TESTS_DIR:= .tests
PARSER_DIR:= $(SRCS_DIR)/parser
HTTP_DIR:= $(SRCS_DIR)/http
SERVER_DIR:= $(SRCS_DIR)/server
CGI_DIR:= $(SRCS_DIR)/CGI

### EXECUTABLE ###
NAME:= webserv

### MODULES & INCLUDES ###
MODULES:= $(PARSER_DIR) $(HTTP_DIR) $(SERVER_DIR)
MODULES:= $(PARSER_DIR) $(HTTP_DIR) $(SERVER_DIR) $(CGI_DIR)
INCLUDES:= -I./includes/ $(patsubst %,-I./%,$(MODULES))

### SOURCES ###
SRCS:= $(SRCS_DIR)/main.cpp

### OBJECTS & SUBDIRS ###
include $(patsubst %,%/module.mk,$(MODULES))
OBJS += $(patsubst $(SRCS_DIR)%.cpp,$(OBJS_DIR)/%.o,$(SRCS))
OBJS += $(patsubst $(SRCS_DIR)%.cpp,$(OBJS_DIR)%.o,$(SRCS))
SUB_DIRS:= $(patsubst $(SRCS_DIR)%,$(OBJS_DIR)%,$(shell find $(SRCS_DIR) -type d))

all: $(NAME)
Expand Down Expand Up @@ -70,8 +71,8 @@ clean:
$(RM) $(OBJS_DIR); \
echo "$(RED)[ DELETE ]$(RESET) Removed object files."; \
fi
@if [ -f $(TEST_PARSER) ] || [ -f $(TEST_HTTP) ] || [ -f $(TEST_SOCKET) ]; then \
$(RM) $(TEST_PARSER) $(TEST_HTTP) $(TEST_SOCKET); \
@if [ -f $(TEST_PARSER) ] || [ -f $(TEST_HTTP) ] || [ -f $(TEST_SOCKET) ] || [ -f $(TEST_CGI) ]; then \
$(RM) $(TEST_PARSER) $(TEST_HTTP) $(TEST_SOCKET) $(TEST_CGI); \
echo "$(GREEN)[ DELETE ]$(RESET) Removed testers."; \
fi

Expand All @@ -98,6 +99,18 @@ test_http:
# @$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEBUGFLAGS) $(SOCKET_SRCS) $(TEST_SOCKET_SRC) -o $(TEST_SOCKET)
# @echo "$(BLUE)[ TEST ]$(RESET) SOCKET ready for testing."

test_cgi:
@$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEBUGFLAGS) $(SANITIZE) $(HTTP_SRCS) $(CGI_SRCS) $(TEST_CGI_SRC) -o $(TEST_CGI)
@echo "$(BLUE)[ TEST ]$(RESET) CGI ready for testing."

format:
@echo "$(BLUE)[ FORMAT ]$(RESET) Formatting code..."
@find ./$(SRCS_DIR) -name "*.cpp" -o -name "*.hpp" \
-exec clang-format -i {} +
@find ./includes -name "*.hpp" \
-exec clang-format -i {} +
@echo "$(BLUE)[ FORMAT ]$(RESET) Code has been formatted."

-include $(OBJS:.o=.d)

.PHONY: clean fclean all re debug run test_parser test_http test_socket
.PHONY: clean fclean all re debug run test_parser test_http test_socket test_cgi
7 changes: 7 additions & 0 deletions includes/webserv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ typedef vector<pair<string, string> > vsp;
// socket_descriptor type
typedef int fd;
/* ----------------------------- ERROR MESSAGES ----------------------------- */
#define THROW_EXCEPTION_WITH_INFO(msg) \
do { \
std::ostringstream oss; \
oss << __FILE__ << ":" << __LINE__ << ": " << R << "error: " << RE << (msg); \
throw std::runtime_error(oss.str()); \
} while (0)

static std::string ERR_NULL("Socket: null ptr error");
static std::string ERR_CREAT("Socket: creation failed");
static std::string ERR_BIND("Socket: binding failed");
Expand Down
2 changes: 2 additions & 0 deletions sources/CGI/.tests/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/python3
print("hello worled")
2 changes: 2 additions & 0 deletions sources/CGI/.tests/file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
echo "Hello, World Bash!"
Loading
Loading