Spaces:
Running
Running
Todor Todorov
commited on
🎨 style: change `http/https` header word/sentence casing (#555)
Browse filesCurrently all HTTP request headers are in snake case and upper case.
The adopted standard is kebab case and title case.
Here you will find more details:
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Standard_request_fields
- src/engines/bing.rs +4 -4
- src/engines/brave.rs +4 -4
- src/engines/duckduckgo.rs +4 -4
- src/engines/librex.rs +4 -4
- src/engines/mojeek.rs +4 -4
- src/engines/searx.rs +4 -4
- src/engines/startpage.rs +4 -4
src/engines/bing.rs
CHANGED
|
@@ -79,13 +79,13 @@ impl SearchEngine for Bing {
|
|
| 79 |
}
|
| 80 |
|
| 81 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 82 |
-
("
|
| 83 |
-
("
|
| 84 |
(
|
| 85 |
-
"
|
| 86 |
"application/x-www-form-urlencoded".to_string(),
|
| 87 |
),
|
| 88 |
-
("
|
| 89 |
]))
|
| 90 |
.change_context(EngineError::UnexpectedError)?;
|
| 91 |
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 82 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 83 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 84 |
(
|
| 85 |
+
"Content-Type".to_string(),
|
| 86 |
"application/x-www-form-urlencoded".to_string(),
|
| 87 |
),
|
| 88 |
+
("Cookie".to_string(), cookie_string),
|
| 89 |
]))
|
| 90 |
.change_context(EngineError::UnexpectedError)?;
|
| 91 |
|
src/engines/brave.rs
CHANGED
|
@@ -54,14 +54,14 @@ impl SearchEngine for Brave {
|
|
| 54 |
};
|
| 55 |
|
| 56 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 57 |
-
("
|
| 58 |
(
|
| 59 |
-
"
|
| 60 |
"application/x-www-form-urlencoded".to_string(),
|
| 61 |
),
|
| 62 |
-
("
|
| 63 |
(
|
| 64 |
-
"
|
| 65 |
format!("safe_search={safe_search_level}"),
|
| 66 |
),
|
| 67 |
]))
|
|
|
|
| 54 |
};
|
| 55 |
|
| 56 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 57 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 58 |
(
|
| 59 |
+
"Content-Type".to_string(),
|
| 60 |
"application/x-www-form-urlencoded".to_string(),
|
| 61 |
),
|
| 62 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 63 |
(
|
| 64 |
+
"Cookie".to_string(),
|
| 65 |
format!("safe_search={safe_search_level}"),
|
| 66 |
),
|
| 67 |
]))
|
src/engines/duckduckgo.rs
CHANGED
|
@@ -65,13 +65,13 @@ impl SearchEngine for DuckDuckGo {
|
|
| 65 |
|
| 66 |
// initializing HeaderMap and adding appropriate headers.
|
| 67 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 68 |
-
("
|
| 69 |
-
("
|
| 70 |
(
|
| 71 |
-
"
|
| 72 |
"application/x-www-form-urlencoded".to_string(),
|
| 73 |
),
|
| 74 |
-
("
|
| 75 |
]))
|
| 76 |
.change_context(EngineError::UnexpectedError)?;
|
| 77 |
|
|
|
|
| 65 |
|
| 66 |
// initializing HeaderMap and adding appropriate headers.
|
| 67 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 68 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 69 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 70 |
(
|
| 71 |
+
"Content-Type".to_string(),
|
| 72 |
"application/x-www-form-urlencoded".to_string(),
|
| 73 |
),
|
| 74 |
+
("Cookie".to_string(), "kl=wt-wt".to_string()),
|
| 75 |
]))
|
| 76 |
.change_context(EngineError::UnexpectedError)?;
|
| 77 |
|
src/engines/librex.rs
CHANGED
|
@@ -72,11 +72,11 @@ impl SearchEngine for LibreX {
|
|
| 72 |
|
| 73 |
// initializing HeaderMap and adding appropriate headers.
|
| 74 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 75 |
-
("
|
| 76 |
-
("
|
| 77 |
-
("
|
| 78 |
(
|
| 79 |
-
"
|
| 80 |
"theme=amoled; disable_special=on; disable_frontends=on; language=en; number_of_results=10; safe_search=on; save=1".to_string(),
|
| 81 |
),
|
| 82 |
]))
|
|
|
|
| 72 |
|
| 73 |
// initializing HeaderMap and adding appropriate headers.
|
| 74 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 75 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 76 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 77 |
+
("Content-Type".to_string(), "application/x-www-form-urlencoded".to_string()),
|
| 78 |
(
|
| 79 |
+
"Cookie".to_string(),
|
| 80 |
"theme=amoled; disable_special=on; disable_frontends=on; language=en; number_of_results=10; safe_search=on; save=1".to_string(),
|
| 81 |
),
|
| 82 |
]))
|
src/engines/mojeek.rs
CHANGED
|
@@ -129,13 +129,13 @@ impl SearchEngine for Mojeek {
|
|
| 129 |
}
|
| 130 |
|
| 131 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 132 |
-
("
|
| 133 |
-
("
|
| 134 |
(
|
| 135 |
-
"
|
| 136 |
"application/x-www-form-urlencoded".to_string(),
|
| 137 |
),
|
| 138 |
-
("
|
| 139 |
]))
|
| 140 |
.change_context(EngineError::UnexpectedError)?;
|
| 141 |
|
|
|
|
| 129 |
}
|
| 130 |
|
| 131 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 132 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 133 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 134 |
(
|
| 135 |
+
"Content-Type".to_string(),
|
| 136 |
"application/x-www-form-urlencoded".to_string(),
|
| 137 |
),
|
| 138 |
+
("Cookie".to_string(), cookie_string),
|
| 139 |
]))
|
| 140 |
.change_context(EngineError::UnexpectedError)?;
|
| 141 |
|
src/engines/searx.rs
CHANGED
|
@@ -66,10 +66,10 @@ impl SearchEngine for Searx {
|
|
| 66 |
|
| 67 |
// initializing headers and adding appropriate headers.
|
| 68 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 69 |
-
("
|
| 70 |
-
("
|
| 71 |
-
("
|
| 72 |
-
("
|
| 73 |
]))
|
| 74 |
.change_context(EngineError::UnexpectedError)?;
|
| 75 |
|
|
|
|
| 66 |
|
| 67 |
// initializing headers and adding appropriate headers.
|
| 68 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 69 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 70 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 71 |
+
("Content-Type".to_string(), "application/x-www-form-urlencoded".to_string()),
|
| 72 |
+
("Cookie".to_string(), "categories=general; language=auto; locale=en; autocomplete=duckduckgo; image_proxy=1; method=POST; safesearch=2; theme=simple; results_on_new_tab=1; doi_resolver=oadoi.org; simple_style=auto; center_alignment=1; query_in_title=1; infinite_scroll=0; disabled_engines=; enabled_engines=\"archive is__general\\054yep__general\\054curlie__general\\054currency__general\\054ddg definitions__general\\054wikidata__general\\054duckduckgo__general\\054tineye__general\\054lingva__general\\054startpage__general\\054yahoo__general\\054wiby__general\\054marginalia__general\\054alexandria__general\\054wikibooks__general\\054wikiquote__general\\054wikisource__general\\054wikiversity__general\\054wikivoyage__general\\054dictzone__general\\054seznam__general\\054mojeek__general\\054naver__general\\054wikimini__general\\054brave__general\\054petalsearch__general\\054goo__general\"; disabled_plugins=; enabled_plugins=\"searx.plugins.hostname_replace\\054searx.plugins.oa_doi_rewrite\\054searx.plugins.vim_hotkeys\"; tokens=; maintab=on; enginetab=on".to_string())
|
| 73 |
]))
|
| 74 |
.change_context(EngineError::UnexpectedError)?;
|
| 75 |
|
src/engines/startpage.rs
CHANGED
|
@@ -57,13 +57,13 @@ impl SearchEngine for Startpage {
|
|
| 57 |
|
| 58 |
// initializing HeaderMap and adding appropriate headers.
|
| 59 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 60 |
-
("
|
| 61 |
-
("
|
| 62 |
(
|
| 63 |
-
"
|
| 64 |
"application/x-www-form-urlencoded".to_string(),
|
| 65 |
),
|
| 66 |
-
("
|
| 67 |
]))
|
| 68 |
.change_context(EngineError::UnexpectedError)?;
|
| 69 |
|
|
|
|
| 57 |
|
| 58 |
// initializing HeaderMap and adding appropriate headers.
|
| 59 |
let header_map = HeaderMap::try_from(&HashMap::from([
|
| 60 |
+
("User-Agent".to_string(), user_agent.to_string()),
|
| 61 |
+
("Referer".to_string(), "https://google.com/".to_string()),
|
| 62 |
(
|
| 63 |
+
"Content-Type".to_string(),
|
| 64 |
"application/x-www-form-urlencoded".to_string(),
|
| 65 |
),
|
| 66 |
+
("Cookie".to_string(), "preferences=connect_to_serverEEE0N1Ndate_timeEEEworldN1Ndisable_family_filterEEE0N1Ndisable_open_in_new_windowEEE0N1Nenable_post_methodEEE1N1Nenable_proxy_safety_suggestEEE1N1Nenable_stay_controlEEE0N1Ninstant_answersEEE1N1Nlang_homepageEEEs%2Fnight%2FenN1NlanguageEEEenglishN1Nlanguage_uiEEEenglishN1Nnum_of_resultsEEE10N1Nsearch_results_regionEEEallN1NsuggestionsEEE1N1Nwt_unitEEEcelsius".to_string()),
|
| 67 |
]))
|
| 68 |
.change_context(EngineError::UnexpectedError)?;
|
| 69 |
|