Skip to content

Commit

Permalink
1.75b: iPhone U-A support added.
Browse files Browse the repository at this point in the history
  • Loading branch information
spinkham committed Nov 21, 2010
1 parent 514ec35 commit 088136e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 1.75b:
--------------

- iPhone U-A support added.

Version 1.74b:
--------------

Expand Down
3 changes: 2 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ parameters...
By default, skipfish sends minimalistic HTTP headers to reduce the amount of
data exchanged over the wire; some sites examine User-Agent strings or header
ordering to reject unsupported clients, however. In such a case, you can use
-b ie or -b ffox to mimic one of the two popular browsers.
-b ie, -b ffox, or -b phone to mimic one of the two popular browsers (or
iPhone).

When it comes to customizing your HTTP requests, you can also use the -H
option to insert any additional, non-standard headers; or -F to define a
Expand Down
18 changes: 17 additions & 1 deletion http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ u8* build_request_data(struct http_request* req) {
ASD("Keep-Alive: 300\r\n");
ASD("Connection: keep-alive\r\n");

} else /* MSIE */ {
} else if (browser_type == BROWSER_MSIE) {

ASD("Accept: */*\r\n");

Expand All @@ -909,6 +909,22 @@ u8* build_request_data(struct http_request* req) {
ASD("Accept-Encoding: gzip, deflate\r\n");
ASD("Connection: Keep-Alive\r\n");

} else /* iPhone */ {

if (!GET_HDR((u8*)"User-Agent", &req->par))
ASD("User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS "
"X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 "
"Mobile/8B117 Safari/6531.22.7 SF/" VERSION "\r\n");

ASD("Accept: application/xml,application/xhtml+xml,text/html;q=0.9,"
"text/plain;q=0.8,image/png,*/*;q=0.5\r\n");

if (!GET_HDR((u8*)"Accept-Language", &req->par))
ASD("Accept-Language: en-us\r\n");

ASD("Accept-Encoding: gzip, deflate\r\n");
ASD("Connection: keep-alive\r\n");

}


Expand Down
1 change: 1 addition & 0 deletions http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ extern u8 ignore_cookies;
#define BROWSER_FAST 0 /* Minimimal HTTP headers */
#define BROWSER_MSIE 1 /* Try to mimic MSIE */
#define BROWSER_FFOX 2 /* Try to mimic Firefox */
#define BROWSER_PHONE 3 /* Try to mimic iPhone */

extern u8 browser_type;

Expand Down
8 changes: 4 additions & 4 deletions skipfish.1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The final report generated by the tool is meant to serve as a foundation for pro
.B \-A user:pass
use specified HTTP authentication credentials
.TP
.B \-F host:IP
.B \-F host=IP
pretend that 'host' resolves to 'IP'
.TP
.B \-C name=val
Expand All @@ -28,8 +28,8 @@ append a custom cookie to all requests
.B \-H name=val
append a custom HTTP header to all requests
.TP
.B \-b (i|f)
use headers consistent with MSIE / Firefox
.B \-b (i|f|p)
use headers consistent with MSIE / Firefox / iPhone
.TP
.B \-N
do not accept any new cookies
Expand Down Expand Up @@ -91,7 +91,7 @@ be less noisy about MIME / charset mismatches on probably
static content
.TP
.B \-M
log warnings about mixed content
log warnings about mixed content or non-SSL password forms
.TP
.B \-E
log all HTTP/1.0 / HTTP/1.1 caching intent mismatches
Expand Down
5 changes: 3 additions & 2 deletions skipfish.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ static void usage(char* argv0) {
"Authentication and access options:\n\n"

" -A user:pass - use specified HTTP authentication credentials\n"
" -F host:IP - pretend that 'host' resolves to 'IP'\n"
" -F host=IP - pretend that 'host' resolves to 'IP'\n"
" -C name=val - append a custom cookie to all requests\n"
" -H name=val - append a custom HTTP header to all requests\n"
" -b (i|f) - use headers consistent with MSIE / Firefox\n"
" -b (i|f|p) - use headers consistent with MSIE / Firefox / iPhone\n"
" -N - do not accept any new cookies\n\n"

"Crawl scope options:\n\n"
Expand Down Expand Up @@ -372,6 +372,7 @@ int main(int argc, char** argv) {
case 'b':
if (optarg[0] == 'i') browser_type = BROWSER_MSIE; else
if (optarg[0] == 'f') browser_type = BROWSER_FFOX; else
if (optarg[0] == 'p') browser_type = BROWSER_PHONE; else
usage(argv[0]);
break;

Expand Down

0 comments on commit 088136e

Please sign in to comment.