Questions tagged [server]

Questions about server.c in pset6.

Filter by
Sorted by
Tagged with
8
votes
2answers
2k views

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

I'm currently working on PSET6 and have implemented the parse() and lookup() functions. When I try to test my code using CS50 (the first part), I get all checks minus the last one, "Requesting two ...
7
votes
1answer
1k views

having trouble validating request line in server.c

My main issue is doing this without using the heap, I think. I set up arrays for each of the pieces of the request-line (e.g. method, request-target, etc.) and set all of them to be of length = strlen(...
2
votes
1answer
2k views

Server.c pset6 issues

I am currently going through server.c in pset 6. this is server.c: https://gist.github.com/anonymous/5b24f101bf5d53018cbc my functions: lookup: https://gist.github.com/anonymous/...
2
votes
2answers
556 views

How do i check my own implementation of server.c

i have completed server.c and now I want to test it! What command do I type in terminal?
2
votes
1answer
237 views

strcat: what am i doing wrong?

I'm currently doing the pest, and I'm at the step which I have "to define a string called path that contains the concatenation of root (a global variable) and absolute-path." As suggested, I'm using ...
2
votes
1answer
240 views

To ensure the file is readable

In pset6, server.c, what should I do to make sure the file is readable? the problem set guide says it's possible to use "stat" or "access"? since both return 0 on success and -1 if not, how do I ...
2
votes
1answer
248 views

"subtraction" of string in pset6 server.c

In server.c in pset6, there is a line of code where a string is "subtracted" from a string. I tried to find out what this operation does by writing a simple program : char* needle = "needle"; ...
1
vote
1answer
120 views

PSET 6 Keeps Stopping Server

Sorry if this question is a duplicate. I tried to look over stackexchange before posting this (and I couldn't find anyone who was having a similar issue). I am having trouble getting my server to do ...
1
vote
1answer
1k views

How to start with load function in server.c?

I've got problems with implementing load function in server.c. I know general pseudocode, but when it comes to deciding which type variables do I need, I'm a bit stuck. Can someone help me with this?
1
vote
1answer
91 views

Pset6 load returns length zero for php files

First time posting so if I'm off the mark here let me know. Basically, in writing server.c I can't figure out how to test my load function now that I've written it. check50 will only work once I've ...
1
vote
1answer
150 views

PSET7: web server permissions problem

Just started pset7 and can't get the web server to load. I've read about this all over the place but can't get anything to work as of yet. Now I've resorted to wiping the whole workspace clean (after ...
1
vote
1answer
381 views

my server pset throws up "505 HTTP Version Not Supported" but i think it should not

Am done with pset6 but want to test if I implemented the server correctly but when I type in the URL (e.g: 192.#.#.#:port#/cat.jpg) into the browser as specified by David, I get the following error "...
1
vote
1answer
310 views

PSET6: Port 8080 already in use?

I've tried using apache50 stop + changing the port and I can't get the webserver to run on my machine, instead I get the error: ~/workspace/pset6 $ ~cs50/pset6/server 8081 public Stopping server ~/...
1
vote
1answer
178 views

PSET6 | server.c | access()

I'm reviewing the server.c source code to better understand it because I believe this particular pset is largely about understanding source code not written by us and how the internet works generally. ...
1
vote
1answer
585 views

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

Every time I input a query on the HTML form, I get a 404 Error even though the query appears in the URL, and printf seem to indicate that my Parse function is correctly extracting the right substring. ...
1
vote
2answers
78 views

Pset6 check50 server1 parse error

I am having trouble addressing the below two errors when I run the first check50 of pset6. check50 2015.fall.pset6.server1 server.c :( Requesting cat.exe returns error code 501 \ expected output, ...
1
vote
1answer
78 views

PSET6 - server.c, trouble with parse

I thought my parse() function was looking pretty good, but I keep consistently getting the same check50 (server1) error: :( Requesting non-existant file returns error code 404 \ expected output, ...
1
vote
1answer
66 views

How to fix this PSet6 Check50 fail?

All other checks pass except this one: :( Requesting hello.php? returns 200, text/html, and correct output \ expected output, not an exit code of 0 I have no idea how to fix it, here is part of ...
1
vote
1answer
74 views

pset6 Some basic questions

I am having a lot of confusion in pset6 because of which i think i am not able to implement the functions. Please answer my two questions(probably dumb questions) Thanks in Advance for your assistance ...
1
vote
1answer
637 views

Load function correct?

I've been working on the pset6 and implemented the parse and lookup function. I just did something with load function but I am not really much sure if it's correct totally. I haven't implemented the ...
1
vote
1answer
219 views

server.c indexes - what is to be done?

This is silly, I did the parsing engine, the locate, straight forward. However, I have no idea what I am supposed to do for indexes. Yes, I read the instructions but they make no sense. "that the ...
1
vote
1answer
322 views

Does the Staff's server.c solution have a small bug?

In pset6 there is the following sentence: if absolute-path does not contain a . (and thus a file extension), respond to the browser with 501 Not Implemented. But when using the Staff's ...
1
vote
1answer
108 views

Why is the pset6 server loop causing failure after success

I have implemented server up to the point of respond to client. When I make a request for static content from Chrome, I get this: GET /cat.html HTTP/1.1 THE QUERY IS THE ABSOLUTE PATH IS /cat.html ...
1
vote
1answer
248 views

why does my server only work when requesting php files from Chrome?

The request headers and response headers in the command line and in Chrome are all fine, but cat.jpg, cat.html, and hello.html do not display anything in Chrome. In the command line, cat.html and ...
1
vote
1answer
615 views

why doesn't strcmp return 0 even though the strings look identical in gdb?

I don't understand why strcmp says these strings are different. In gdb they look identical. I can't figure it out and I have searched the forum and didn't have any luck. Please let me know if I can ...
1
vote
1answer
801 views

problems about "respond to client" and "concatenate root and absolute-path" in server.c

What does "respond to client" mean? What should I do to respond to a browser? And, should I use "printf" to print out the response? Another problem is, when I refresh the browser, my program ...
1
vote
1answer
33 views

A mistake in pset 6 source code server.c ?

in This block of code an int field is defined and initialized to 0 in order to count the number of fields present in the HTTP request; However, it's not used afterward. And it's value is checked to ...
1
vote
1answer
69 views

server.c segmentation fault

I couldn't find the cause of segmentation fault when i run the server I have used valgrind to find where is the memory leaks .. and this is the result : ==2186== Memcheck, a memory error detector ==...
1
vote
2answers
156 views

PSET6 Indexes Doesn't Work

Regardless of what I do, I can't seem to get the indexes function working. It always seems to return null. char* indexes(const char* path) { char* inPHP = malloc(sizeof(char) * strlen(path) + 11); ...
1
vote
1answer
62 views

pset6: problems with integer to pointer conversion and vice versa

Got stuck with a couple of problems after debugging what I could. I placed -> before the code lines where the problems occur. The first -> relates to question 1 the other three relate to question 2. ...
1
vote
1answer
70 views

Pset6 Server works fine for cat.jpg, but fails check50

I've implemented load and indexes and the website seems to work ok. I say ok because it prints out hello, hello, world when I access hello.php, and fails pretty much all the checks in the second ...
1
vote
1answer
75 views

Pset6 Server 403 Error, problem with path

I passed the first check50 for Pset6 but still can't seem to get my server working after implementing indexes and load. I've been getting 403 errors whenever I request my homepage, as well as an ...
1
vote
1answer
30 views

Pset6 - Non-blocking socket in connected()

I'm currently on pset6 and I'm trying to read through the code for server.c to understand what it's doing. I've come across part of the code that I don't understand: /** * Checks (without blocking) ...
1
vote
1answer
271 views

Help with pset6 parse function

I am having trouble with the pset6 parse function. I used check50 after implementing parse, and everything checks out except I get these two errors: :( HTTP/1.0 returns error code 505 \ expected ...
1
vote
2answers
128 views

PSET6 server: Make server error - Please please help =(

I was almost finished debugging server.c (the only thing that didn't work was that I was getting a 404 error when submitting my query on hello.html) by using gdb. When I thought I'd noticed what the ...
1
vote
1answer
373 views

pset6: /hello.php?name=david shows up in URL but hello.html page content loads

Currently working on pset6 server.c. All of my pages load properly except for one thing: when I submit a name in the text box from hello.html, the query properly shows up in the URL, but the hello....
1
vote
1answer
283 views

Pset6 (server) - parse function causes a segfault

Segmentation fault in my parse function (at strncpy(http, http_temp, 8);). See below relevant parts of function. Valgrind returns error of not stack'd, malloc'd or (recently) free'd but I'm copying ...
1
vote
2answers
321 views

pset6 (server.c) - 404 not found with /cat.jpg, but works with other files

I have been having trouble with server.c My version seems to work with hello.html. However, when I try and use the following with telnet GET /cat.jpg HTML/1.1 I get HTTP/1.1 404 file not found ...
1
vote
1answer
352 views

pset6 Web server responses

in pset6 what should be the response if we make request from telnet program as GET / hello.html HTTP/1.1? The staff solution report the error as "HTTP/1.1 505 HTTP Version Not Supported" even though ...
1
vote
1answer
867 views

My version of server.c not working

When I use telnet and pass GET /cat.html HTTP/1.1, the server throws four errors all at once. HTTP/1.1 400 Bad Request HTTP/1.1 501 Not Implemented HTTP/1.1 400 Bad Request HTTP/1.1 505 HTTP Version ...
1
vote
1answer
601 views

cat.jpg not displaying in cat.html

I've gotten all functions of server.c to work, including displaying hello.html successfully. However, when I attempt to access cat.html, program is not displaying the image. The chrome developer ...
1
vote
2answers
434 views

Can not run staff solution of server.c

I am trying to run the staff solution of server.c but I get an error that I need to install rsplib=legacy-wrappers. What does it mean? I just updated the appliance and restarted it, but problem is ...
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
1answer
172 views

pset6 address already in use [duplicate]

I have a problem with pset6 (server). I was debugging server on gdb, using run -p 8080 public and then I quitted. Then I made some changes to server.c, compiled it, and used gdb again. Now if I submit ...
1
vote
0answers
80 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
974 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
654 views

pset6 (server.c) content length

I am repeatedly getting ERR_CONTENT_LENGTH_MISMATCH in Chrome's Network Status tab when trying to load any file in the appliance's browser. This is despite the content loading correctly when I run it ...

1
2 3 4 5