<commit_before># How to contribute

We welcome third party contributions H2O. The most straightforward to
do so, is to fork the project and submit a PR. If the change you're
proposing is substantial, it might be a good idea to open an issue in
the issue tracker first.

# Coding style

## C

H2O is built on a multitude of platforms: \*BSD, Mac OS, Solaris and
Linux. It uses a dialect of C close to c89 and c99 intended to compile
on most gcc functions, and we avoid GNU extensions.

PRs are automatically built in Travis, and a test suite is run over
the code. When possible, please add test coverage to the code that
you're submitting.

## Formatting

H2O uses `clang-format` (https://clang.llvm.org/docs/ClangFormat.html)
in order to maintain a uniform coding style on the code base, running
the tool before submitting might make the review process smoother.

To summarize, the coding style resembles the Linux kernel's with the
difference that it uses 4 spaces rather than one tab for indentation.

Here's a `.vimrc` snippet that would use this style:

```
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
```

## Naming


### Structs

Structs are prefixed with `st_` and suffixed with `_t`. Structs that are
not private to a single translation unit are typedef'ed and prefixed with
`h2o_`, and suffixed with `_t`:

```
/* public struct */
typedef struct st_h2o_conn_t h2o_conn_t;

struct st_h2o_conn_t {
....
};

/* private struct */
struct st_on_client_hello_ptls_t {
...
};
```

### Functions

As with structs, publicly visible functions are prefixed with `h2o_`,
such as `h2o_process_request`, whereas private functions don't use one
`get_ocsp_response`.

### Goto labels

Goto labels use upper case, and are indented with the matching code:

```
void fn(const char *err)
{
    if (global) {
        if (err == NULL)
            goto Ok;

    Ok:
        this_is_ok();
    }
}
```

# Tests

H2O uses two main facilities for tests: unit tests in C and
integration tests written in perl. Both tests can be run with `make
check`. Some tests require to be run as root, and can be run with `make<commit_msg>Add content type for the code snippets<commit_after># How to contribute

We welcome third party contributions H2O. The most straightforward to
do so, is to fork the project and submit a PR. If the change you're
proposing is substantial, it might be a good idea to open an issue in
the issue tracker first.

# Coding style

## C

H2O is built on a multitude of platforms: \*BSD, Mac OS, Solaris and
Linux. It uses a dialect of C close to c89 and c99 intended to compile
on most gcc functions, and we avoid GNU extensions.

PRs are automatically built in Travis, and a test suite is run over
the code. When possible, please add test coverage to the code that
you're submitting.

## Formatting

H2O uses `clang-format` (https://clang.llvm.org/docs/ClangFormat.html)
in order to maintain a uniform coding style on the code base, running
the tool before submitting might make the review process smoother.

To summarize, the coding style resembles the Linux kernel's with the
difference that it uses 4 spaces rather than one tab for indentation.

Here's a `.vimrc` snippet that would use this style:

```vim
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
```

## Naming


### Structs

Structs are prefixed with `st_` and suffixed with `_t`. Structs that are
not private to a single translation unit are typedef'ed and prefixed with
`h2o_`, and suffixed with `_t`:

```c
/* public struct */
typedef struct st_h2o_conn_t h2o_conn_t;

struct st_h2o_conn_t {
....
};

/* private struct */
struct st_on_client_hello_ptls_t {
...
};
```

### Functions

As with structs, publicly visible functions are prefixed with `h2o_`,
such as `h2o_process_request`, whereas private functions don't use one
`get_ocsp_response`.

### Goto labels

Goto labels use upper case, and are indented with the matching code:

```c
void fn(const char *err)
{
    if (global) {
        if (err == NULL)
            goto Ok;

    Ok:
        this_is_ok();
    }
}
```

# Tests

H2O uses two main facilities for tests: unit tests in C and
integration tests written in perl. Both tests can be run with `make
check`. Some tests require to be run as root, and can be run with `make
{'fraction_non_alphanumeric': 0.07289719626168224, 'fraction_numerical': 0.008411214953271028, 'mean_word_length': 3.8263810597519727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7411513', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1268, 'n_words': 634}