Web Requests - POST Flashcards

1
Q

What is the main purpose of POST requests in web applications?

A

To transfer files or user parameters from the URL within the HTTP Request body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does POST differ from GET in terms of data placement?

A

POST places user parameters within the HTTP Request body, while GET places them in the URL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is one benefit of using POST requests regarding logging?

A

Lack of Logging: It avoids inefficient logging of large uploaded files as part of the requested URL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why are there fewer encoding requirements for POST requests compared to GET requests?

A

POST places data in the body which can accept binary data, reducing the need for encoding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a limitation of URL length for GET requests?

A

Generally, a URL’s length should be kept to below 2,000 characters, limiting data transmission

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a common use case for POST requests in web applications?

A

Submitting login forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What command can be used to send a POST request with cURL?

A

curl -X POST -d ‘data’ http://<SERVER_IP>:<PORT>/</PORT></SERVER_IP>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What flag is used in cURL to follow redirection after authentication?

A

-L

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the significance of the Set-Cookie header in HTTP responses?

A

It allows browsers to persist authentication without needing to log in each time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you view the response headers, including cookies, in cURL?

A

Use the -i or -v flags

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What cURL flag is used to send a cookie with a request?

A

-b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you specify a cookie in a header using cURL?

A

curl -H ‘Cookie: cookie_name=cookie_value’ http://<SERVER_IP>:<PORT>/</PORT></SERVER_IP>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What kind of data format is used when sending POST data in a JSON request?

A

application/json

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What command is used to replicate a POST request with JSON data using cURL?

A

curl -X POST -d ‘{“search”:”london”}’ -H ‘Content-Type: application/json’ http://<SERVER_IP>:<PORT>/search.php</PORT></SERVER_IP>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the expected response when correctly sending a search request for ‘london’?

A

[“London (UK)”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is one potential exercise to understand the impact of headers in requests?

A

Repeat the request without adding the cookie or content-type headers

17
Q

What is the benefit of using cURL for web application assessments?

A

It allows for faster testing of web applications without interacting with the front-end

18
Q

What method can be used to copy a request as Fetch in developer tools?

A

Right-click on the request and select Copy>Copy as Fetch