5 votes

How to start with load function in server.c?

When I hit my road block here, I went back to the source code and re-watched the walkthrough videos, specifically this one: https://www.youtube.com/watch?v=OnAItxJhS70 There are subtle hints ...
Peter's user avatar
  • 1,412
5 votes
Accepted

PSET 6 Keeps Stopping Server

The Stopping server message comes from the stop() function defined here: /** * Stop server, deallocating any resources. */ void stop(void) { // preserve errno across this function's library ...
hotwebmatter's user avatar
  • 3,050
4 votes
Accepted

PSET6 Server - Parse function (requesting two files in a row)

I just completed this pset successfully.. I had the same issue and i moved on implementing the next function because if you see in the sandbox link you will find under that error written TODO..which ...
Muhammad Shahzad Bajwa's user avatar
4 votes
Accepted

PSET7: web server permissions problem

403 Forbidden / permissions / chmod: the Definitive Guide TL;DR: PHP files and config.json need to be set to chmod 640 despite what it says in the Problem Specification. Hope this helps!
hotwebmatter's user avatar
  • 3,050
4 votes
Accepted

Pset6 load returns length zero for php files

You would need to use debug50 or gdb to "stop the program and inspect", not check50. Since you are asking for help with debugging, my comments are intentionally cryptic. If load returns false, you ...
DinoCoderSaurus's user avatar
3 votes

PSET6 | server.c | access()

On a high level I believe it is used to test whether a file exists and/or how it can be manipulated. But how exactly does it do this? According to the man pages: The check is done using the ...
ChrisG's user avatar
  • 7,396
3 votes
Accepted

Pset6 Server.c: 404 Error only when submitting query on hello.html, everything else works

According to your terminal output, abs_path is wrong. Unless you have a file named hello.php?name=gege019, 404 is the right answer. abs_path should not include the ? or anything that follows.
DinoCoderSaurus's user avatar
3 votes
Accepted

PSET6: Port 8080 already in use?

Have you tried to kill the server process before trying those commands? killall server Also you can kill the apache process, if it's running: sudo killall apache2
Yuri Laguardia's user avatar
2 votes
Accepted

server.c indexes - what is to be done?

If it exists, you simply have to return its path, as a string. For example, if the input is the string /gifs/cats, and there is indeed a file named index.html in the /gifs/cats directory, then you ...
Levi Roth's user avatar
  • 188
2 votes
Accepted

Server.c Non-existant file and cat.exe question

This is bad abs_path = malloc(sizeof(LimitRequestLine + 1)); (and query too). Remember, parse receives a pointer to abs_path, which is already allocated on the stack (implicitly) in main. The malloc ...
DinoCoderSaurus's user avatar
2 votes
Accepted

How to test own code pset6 server 2016?

I created a separate file called servertest.c to use while working through parse, the stage I just finished. I used a simple main like this to test various inputs to parse: int main(void) { char* ...
Peter's user avatar
  • 1,412
2 votes
Accepted

Server.c pset6 issues

At least part of your problem is in parse. abs_path is not null terminated. That would cause the behaviour you describe (I get cat.jpg correctly only the first time the server is ever asked:) query, ...
DinoCoderSaurus's user avatar
2 votes

Debugging Webserver in C

GDB should be a very useful tool for debugging server. The waiting is the hardest part. Remember server will be waiting for input from a browser/curl to process something or waiting for gdb to ...
DinoCoderSaurus's user avatar
2 votes
Accepted

In pset6 server.c, does using realloc() reset the file pointer for fread()?

per fread's man page: size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); The function fread() reads nmemb elements of data, each size bytes long, from the stream pointed to by ...
kzidane's user avatar
  • 17.7k
2 votes

Load function correct?

The biggest problem is that you need to null terminate *content before returning the function. I think it would be better to do this with buffer so you maintain your "*content = &buffer[0]" ...
Brendan Rafferty's user avatar
2 votes
Accepted

pset6 Some basic questions

They are passed to PARSE the following parameters line=0xbfffaf20 "GET /cat.jpg HTTP/1.1\r\n" ( line is a pointer to said chain ) abs_path=0xbfffd021 "" ( pointer to an empty string ) query=...
MARS's user avatar
  • 5,169
2 votes
Accepted

Pset 6 server.c, Check50 does not work

These three failed tests should give you a hint that it's testing the code you wrote for indexes. :( Requesting /test redirects to /test/ :( Requesting /test/ outputs /test/index.html :...
DinoCoderSaurus's user avatar
2 votes
Accepted

Help with understanding PSet6

I was in your some place until today (I just passed the second check50 and submitted it this afternoon having begun in February). You have to attack it iteratively, debug CONSTANTLY, compare your ...
Peter's user avatar
  • 1,412
2 votes
Accepted

How to fix this PSet6 Check50 fail?

This \ expected output, not an exit code of 0 is a seg fault. For testing, you would need to request /hello.php? with a curl request instead of a browser. Browsers (firefox and opera in my testing) ...
DinoCoderSaurus's user avatar
2 votes
Accepted

Please help, stuck on pset6 first test

There is (should be) only one error(505) in server, and it comes from parse. That should immediately draw your attention to this if (strcmp (Copy_parse_line[Http_Version] , "HTTP/1.1")!=0) ...
DinoCoderSaurus's user avatar
2 votes
Accepted

Pset6 one check50 error

It's a common problem when abs_path and query are built one character at a time. The problem seems to be in parse. abs_path (and query) are not properly null-terminated. So server returns a 404 error ...
DinoCoderSaurus's user avatar
2 votes

error in load and indexes function

Reread the specification for indexes in the instructions. Complete the implementation of indexes in such a way that the function, given a /path/to/a/directory, returns /path/to/a/directory/index....
DinoCoderSaurus's user avatar
2 votes
Accepted

Getting some errors in server.c pset 6. Don't know what to do,Pls help

lookup :( Requesting cat2.HTML returns 200, text/html, and correct file :( Requesting cat3.HtMl returns 200, text/html, and correct file from the spec text/html for any file whose path ...
DinoCoderSaurus's user avatar
2 votes
Accepted

PSET6 - server.c, trouble with parse

Have you noticed that every request you send through a browser or curl gives a 501? server returns 501 in 3 places, 2 in this parse and one in main. You might want to take it for a spin in the new ...
DinoCoderSaurus's user avatar
2 votes
Accepted

How to stop server?

The error message: server: no process found should be self-explanatory. You're trying to kill a process that is not running. That's because the Apache2 server daemon process is not called server. ...
hotwebmatter's user avatar
  • 3,050
2 votes
Accepted

Help needed for CS50 IDE flask server

Change the call from flask run to flask run --host=0.0.0.0 --port=8080 and it should work, as per this reddit post.
DinoCoderSaurus's user avatar
1 vote
Accepted

pset6 problem with cat

You are reading bytes in using fgetc, I made this same mistake and it turns out that although a char is 1 byte and you are wanting to read the image file 1 byte at a time, fgetc will specifically only ...
Claire's user avatar
  • 96
1 vote

PSET6 Server - Parse function (requesting two files in a row)

Doesn't the server request files one at a time? the server does not request files at all. the client (e.g., telnet, curl, a browser, etc) does. and it does request one file at a time. however, if ...
kzidane's user avatar
  • 17.7k
1 vote
Accepted

Pset6 Server runs fine but check50 fails

Remember, the browser is very forgiving. check50 is very precise. If one pixel was "wrong" in cat.jpg, neither the browser nor the human eye would detect it. check50, on the other hand, is looking for ...
DinoCoderSaurus's user avatar
1 vote

My server.c parse function fails in cs50 check

From man strstr: The strstr() function finds the first occurrence of the substring needle in the string haystack. If you run server under gdb, set a break at parse, and evaluate crawler and ...
DinoCoderSaurus's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible