Questions tagged [server]

Questions about server.c in pset6.

48 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
27 views

bind socket to port. But it's beeing used

I am trying to make a server to store data. I have some problem when I start he server it works good but then if i close it and start it again within say 30 sec the port is used. I used netstat -antu ...
1
vote
0answers
1k views

PSET 6 Server.c Parse Method

I am currently writing the parse method for pset6 server.c. I have rewritten it many times and I have never gotten it to work. I currently am getting 403 forbidden every time I try to run it. Here is ...
1
vote
0answers
462 views

No error messages but also no success when running SERVER from CS50 pset6. Help?

Hey so basically I've implemented code for lookup, load, and parse that compiles and (in my own eyes) should work logically. When I run it, the program tells me "Get HTML/1.1" but then nothing on my ...
1
vote
0answers
332 views

Pset6 server - 501 Not Implemented error

This is related to my earlier question, but as it turns out that I mistyped the error code in server.c and actually have a 501 Not Implemented error (instead of a 505), I made a new question because ...
1
vote
0answers
83 views

Why does chrome not work with server, but firefox does?

I got server (from pset6) working on Firefox, but not Chrome. Chrome will either not show anything, or just show a error message if there's an error. Everything works on Firefox, except it will not ...
1
vote
0answers
976 views

How to run my copy of server.c

I am sure this is a stupid question, but I am struggling to workout how I actually run my version of server.c in pset6. Do I need to compile it? Whenever I try and "make" the file, terminal reports ...
0
votes
1answer
36 views

Load function implementation check - pset 6 (server.c)

bool load(FILE* file, BYTE** content, size_t* length) { char* data = malloc(sizeof(BYTE)); int i = 0; while ((data[i] = fgetc(file)) != EOF) { i++; data = realloc(data, (sizeof(BYTE) * i) );...
0
votes
1answer
45 views

Why might my parse return seg.fault to check50?

Below is my parse function in server.c pset6; The code is not fully commented yet, my bad; Nonetheless, why are all exit code 0 in check50, where is the loophole? Thank you. bool parse(const char* ...
0
votes
1answer
81 views

PSET6 - Double free error

I'm getting stuck in the last lines of PSET6. Apparently the problem is in the LOAD function. Check50 server2 getting all but 1 lines marked red :( and when running the program I get * Error in `./...
0
votes
1answer
80 views

PSet 6 Parse Function (check50 issue)

I hope you are well! I am currently on pset6 and I am stuck on the parse function. So far I have managed to get check50 to go all but green on a few checks: https://sandbox.cs50.net/checks/...
0
votes
1answer
33 views

pset6 three errors and i don't know why

in my work when i try ./server it show me stopping server then i use printf in start function to know what wrong and i know if i type ./server puplic start function in root=realpath(path,NULL) show ...
0
votes
0answers
55 views

pset server: Two errors that i cant solve

Blockquote My server get two errors at cs50check: -Requesting cat.jpg returns 200, image/jpeg, and correct image (TODOS) -Requesting two files in a row (cat.html then cat.jpg) succeeds (TODOS)
0
votes
1answer
74 views

PSET6 Cannot Run Staff implementation from IDE

I have just started pset6 and i am trying to run staff's implementation. However I am getting error as shown in picture below. Kindly suggest the fix. Thanks ~/workspace/ $ cd /home/cs50 /home/cs50/ $...
0
votes
1answer
125 views

:( Requesting cat.exe returns error code 501

this is some pain in the neck every single test is passed except :( Requesting cat.exe returns error code 501 can you please help me my brain is a war zone right now here is my code const char* ...
0
votes
0answers
196 views

not passing check50

i am getting the following errors on running check50 on server.c :) server.c exists :) server compiles :) HTTP/1.0 returns error code 505 :) Method of 'abcGET' returns error code 405 :) Method of '...
0
votes
1answer
80 views

Problem with parse function

When i run Check50 (server1) , It shows me the following errors AFTER EDIT : :( HTTP/1.0 returns error code 505 \ expected output, but not "HTTP/1.1 404 Not Found\r\nContent-Type:..." :( ...
0
votes
1answer
107 views

What should be stored in abs_path and query if this request line is passed to parse?

If my request line is- GET /hello.php?name=mike HTTP/1.1 What should be stored in abs_path and query fields? and if my request line is- GET /hello.html HTTP/1.1 then what should be stored in abs_path ...
0
votes
1answer
132 views

CS50 pset6 check50 errors

I have completed my first draft of pset6 web server and I have used valgrind to check my program for memory leaks of which there seem to be none. However, when I ran my server.c file through check50 I ...
0
votes
0answers
30 views

My PSET6 server.c program compiles fine but appears to stop when it gets to finding the root

my command line entry is ./server https://ide50-applebyoz.cs50.io/public/ I've set some printf commands to show path and root and the result is: path: https://ide50-applebyoz.cs50.io/public/ root: (...
0
votes
1answer
125 views

Server.c trying to run it on mac

I tried running server.c outside the appliance on my mac and when compiling got the following message server.c:358:26: error: implicit declaration of function 'memmem' is invalid in C99 [-Werror,...
0
votes
1answer
45 views

PSET6: Question with Mallocing char* for PARSE

I'm currently working on PSET6 and had a question for the parsing section. I decided to use strtok() and as a result, will need to malloc memory when creating new char*. How do i know how much memory ...
0
votes
0answers
81 views

pset6 | error 404

All check50 passes. But when I telnet this: GET /cat.html HTTP/1.1 I receive an error 404! But the file exists inside pset6's public folder. The error is flagged here (line 208): // ensure path ...
0
votes
0answers
71 views

Server.c failing test 1 with all the same error code

I have finally compiled my pset6 (took me quite a while...) but now I'm running into a problem. When I ran the first check50 all the tests are giving me a error code of: "\ expected output, not an ...
0
votes
0answers
100 views

Pset 6 Server won't compile

I started cs50 last year in October and wasn't able to finish it. But now I'm continuing onto my journey in which I am picking up from pset6. However, I don't seem to be too familiar with the system (...
0
votes
0answers
245 views

Guys getting problem with cat.exe

Hey friends thakyou for your help in advance I am having problem with my parse and lookup function. check50 is returning all fine except this :disappointed: Requesting cat.exe returns error code 501 ...
0
votes
0answers
43 views

Week7 server.c incomplete code - misses incrementing of variable

Team! I have reported the issue on facebook, but have not received a feedback, so I decided to post here. Week7, server.c program. Before downloading, I did go through usual update50. I believe ...
0
votes
1answer
79 views

Pset 6 Server stuck in endless loop in request function, staff server implementation also hangs

I cannot get the server to respond after sending a request. My code compiles and I checked with valgrind and had no issues. I have been using Code::Blocks IDE to help debug easier but have also used ...
0
votes
0answers
297 views

Pset6 seems to work but fails check50

I've updated my 2015 solution for pset6 Server (which I never got around to submitting) to the 2016 requirements and finally it seems to work (again). I can open the cat images and the php also works, ...
0
votes
0answers
596 views

pset6 server.c check50 showing: unexpected end of input

I finished my server.c, and everything works well on the server. When I used "check50 2015.fall.pset6.server1 server.c" after parse, everything is green, but when I tried "check50 2015.fall.pset6....
0
votes
0answers
152 views

Pset 6 Server Seg Fault when fread hello.php

All my code works except for loading or executing hello.php. When running GDB it seemed like I got seg fault in the fread line of my code. The same piece of code works fine for html and jpg, thou. ...
0
votes
1answer
248 views

pset6 redirect loop

I can't figure out what is wrong with my code, and I don't know where the issue is. I have tried to figure it out by putting printf calls everywhere, and it appears that my parse function works as ...
0
votes
1answer
234 views

pset6 server.c ide50 400 Bad Request

I am doing pset6 (for the second time) and have it all working on the new platform (ide50), however when I load my workspace's domain I get a 400 Bad Request message but otherwise the page loads as it ...
0
votes
1answer
196 views

Pset6 (Server.c) Segmentation Fault, Unitialized values

I am getting a segmentation fault when I try to run access a page using the server, as well as 404 and 403 errors. I used Valgrind, and it states "Conditional jump or move depends on uninitialised ...
0
votes
1answer
364 views

pset6: problem parsing the request line in server.c

I feel like I'm going in circles trying to parse the request line into its constituents. It looks like method and requesttarget are ok, but I keep getting too many characters for HTTPver. For "GET / ...
0
votes
0answers
157 views

Pset6 Error 404/odd results - prob with my concatenation?

I get some odd results when I try to run my server. Specifically, I get no errors, but also no content when I search for hello.html; I get error 501 (not implemented) when I search for cat.jpg ...
0
votes
0answers
175 views

pset6 internal server error 500, debugged and variables all correct, need help!

I cannot get past this error, internal server error 500. I have debugged using printf and all variables are holding the right values (request target, absolute path, path). I added a printf line to the ...
0
votes
0answers
300 views

telnet error (was working fine) now unable to resolve name/service not known

I had been happily testing my server.c code using telnet, resolved several issues and was tackling the last error when telnet stopped working. I entered the same command as I had done 50 times before, ...
0
votes
0answers
404 views

Segmentation Fault caused by strlen in server.c. Am I supposed to allocate something here?

Having some issues with my server.c code. When obtaining the length of one of the Request Tokens using strlen, it causes a Segment Fault. Is there something I need to be allocating to the heap? How ...
0
votes
1answer
93 views

a question about(extracting queries and extensions in a request line )

I am trying to extract the query and the extension from request-line but i don't know what's the maximum length of a query and a file extension so that I can know the size of the char array to store ...
0
votes
1answer
74 views

Segementation Issue in Pset 6

I am trying to implement Pset6 but I'm having a huge problem with segmentation faults caused by strstr or strchr. The offending lines are printf("OK %s\n", reqLine); tempStr = strstr(reqLine, "HTTP/...
0
votes
0answers
136 views

Server can display all other files except the response for hello.html

I am currently working on server.c and my server can display all other files except the response for hello.html, which is hello.php. I have tried things such as deleting the query part after .php and ...
0
votes
1answer
169 views

PSET6 Web Server: Static contents work while dynamic leads to a seg fault

I've browsed the questions asked, many of them helped to fix my code but I'm facing a last challenge and I've no idea how to pass it. Every test made with "cat.jpg", "cat.html" or "hello.html" works ...
0
votes
2answers
603 views

Can't find cause of segmentation fault in server.c pset6

I need help finding cause of the segmentation fault in my server.c. I've been using gdb line by line for this pset and I finally think I can use it. However, it reports the seg fault at the line 130 ...
0
votes
0answers
147 views

pset6 server: no data received, no errors

I am working on the server pset. I have compiled all my code, and when I put in my IP address and the port number I get no errors. However, my program prints out (in the terminal) the response to ...
0
votes
0answers
174 views

Error when openening php through html form server.c

My server.c works perfectly. And when i open a php by manually entering for instance /hello.php?name=Mihaly it works. however when using hello.html which opens the php through a form the page doesn't ...
0
votes
0answers
188 views

Problem using a function to manipulate strings in pset6 server

This given code in server.c gets the slice of string up to an appearance of \n. const char* haystack = request; char* needle = strstr(haystack, "\r\n"); if (needle == NULL) { ...
0
votes
0answers
589 views

pset6 (server.c) strcpy and pointer behaviour

I have come across an interesting little problem in server.c which I hope someone could explain so I can learn from it please. I have been happily defining substrings from the request-line using ...
0
votes
0answers
394 views

pset 6, server.c, query sent but hello.php doesn't receive it

Although the spec does not mention to handle .php files, I found that if I do not have my lookup function return "text/html" when it receives a .php extension, then I get a 501 Not Implemented error. ...